• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Mix of hibernate inheritance strategies

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
  Hello!

  I have 2 entities:

 



  And data from B successfully persists in table A. So, one table for 2 entities - A and B.
 

  I created third entity - C.
 

  I want data from C to persisted in separate table - C.  
  So, finally -  one table A for A/B entities,  and one more table for C.
  In this case 2 strategies are mixed: SINGLE_TABLE  and  TABLE_PER_CLASS

  For this purpose i applied to B annotation @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)

 

 But without success - data from C persisted in single table A.   So SINGLE_TABLE  is working only

 

 
Creator of Enthuware JWS+ V6
Posts: 3395
312
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't mix different stategies in the same class hierarchy.
 
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic