Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » InheritancePolicy SingleTableStrategy in Dynamic Persistence
InheritancePolicy SingleTableStrategy in Dynamic Persistence [message #1063015] Tue, 11 June 2013 15:13 Go to next message
Gaurav Gupta is currently offline Gaurav Gupta
Messages: 9
Registered: June 2013
Location: India
Junior Member
as Specified in Eclipselink Source code isJoinedStrategy = true; by default
but when i applied SingleTableStrategy(means internally isJoinedStrategy = false)
there are no changes in DataBase Schema (still joined strategy is applied default)

Parent Entity Descriptor
.getInheritancePolicy().setSingleTableStrategy();

Child Entity Descriptor
.getInheritancePolicy().setSingleTableStrategy();
Re: InheritancePolicy SingleTableStrategy in Dynamic Persistence [message #1064268 is a reply to message #1063015] Tue, 18 June 2013 09:55 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

How are you building your descriptors? If you use JPA orm.xml then JPA auto-mapping and defaults will occur.

If you are building descriptors manually, then JPA auto-mapping and defaults do not apply, you must set everything.
For inheritance if you declare a table in the subclass, it will have a table, if you don't, then it won't, it will just share its parent's table.


James : Wiki : Book : Blog : Twitter
Re: InheritancePolicy SingleTableStrategy in Dynamic Persistence [message #1064520 is a reply to message #1064268] Wed, 19 June 2013 11:49 Go to previous message
Gaurav Gupta is currently offline Gaurav Gupta
Messages: 9
Registered: June 2013
Location: India
Junior Member
James Sutherland wrote on Tue, 18 June 2013 09:55
For inheritance if you declare a table in the subclass, it will have a table, if you don't, then it won't, it will just share its parent's table.

Thanks James for your response , problem resolved Smile
I was calling
.getInheritancePolicy().setSingleTableStrategy();
in both Parent and Child Entity Descriptor but using different table name in parent and child entity.

Solution : Using same table name for both parent and child entity with
.getInheritancePolicy().setSingleTableStrategy();
in Parent and Child Entity Descriptor , I am able to achieve Single Table Inheritence Strategy Smile

[Updated on: Wed, 19 June 2013 11:56]

Report message to a moderator

Previous Topic:JPQL Composite Key in Dynamic Persistence
Next Topic:Problem with QueryHints.FETCH and ORDER BY clause
Goto Forum:
  


Current Time: Fri Aug 01 01:44:23 EDT 2014

Powered by FUDForum. Page generated in 0.01544 seconds