Is Eclipse Dynamic Persistence support SINGLE_TABLE Inheritance strategy ? [message #1720819] |
Thu, 21 January 2016 04:14  |
Eclipse User |
|
|
|
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 10:32  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03125 seconds