Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Is Eclipse Dynamic Persistence support SINGLE_TABLE Inheritance strategy ?
Is Eclipse Dynamic Persistence support SINGLE_TABLE Inheritance strategy ? [message #1720819] Thu, 21 January 2016 09:14 Go to next message
gaurav Gupta is currently offline gaurav GuptaFriend
Messages: 1
Registered: January 2016
Junior Member
Is Eclipse Dynamic Persistence support SINGLE_TABLE Inheritance strategy ?

I have tried dynamic persistence for both JOINED and TABLE_PER_CLASS , this is working fine but not working for SINGLE_TABLE .

For example :
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="2.1"     xmlns="....sample xml.....">
    <package>example.jpa.dynamic.model.employee</package>
    <entity class="Node" access="VIRTUAL" >
            <inheritance strategy="SINGLE_TABLE" />
        <attributes>
            <id name="id" attribute-type="Integer"/>
            <basic name="name" attribute-type="String" />
        </attributes>
    </entity>
    <entity class="Folder" access="VIRTUAL" parent-class="Node">
        <attributes>
            <basic name="iconColor" attribute-type="String" />
        </attributes>
    </entity>
    <entity class="File" access="VIRTUAL" parent-class="Node">
        <attributes>
            <basic name="extension" attribute-type="String" />
        </attributes>
    </entity>
</entity-mappings>


In this case scenario only single table Node is created with 3 column ID , NAME , DTYPE .
Re: Is Eclipse Dynamic Persistence support SINGLE_TABLE Inheritance strategy ? [message #1721193 is a reply to message #1720819] Mon, 25 January 2016 15:32 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1380
Registered: July 2009
Senior Member
Dynamic persistence works with any inheritance type. The issue you seem to be encountering is with DDL generation, and since a table can only be created once, it can't be created later on with extended attributes as you add in additional subclasses - they need to all be created upfront. You can try using the "create-or-extend-tables" "eclipselink.ddl-generation" option, but as DDL generation is not meant for production, what is instead recommended is you add generic attributes to your table upfront and then assign them when creating dynamic entities.

Best Regards,
Chris
Previous Topic:EclipseLink read performance issue with MongoDB
Next Topic:NPE in MethodAttributeAccessor.getAttributeValueFromObject
Goto Forum:
  


Current Time: Mon Mar 08 13:33:12 GMT 2021

Powered by FUDForum. Page generated in 0.02079 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top