Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

[EJB3] Table per Concrete Class Strategy

 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the motivation behind the "Table per Concrete Class Strategy" @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) ?
It's not recommended, poor design, and optiional for persistence providers. Wouldn't it better not to put it in the spec ?
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

this mapping can be very useful when you have to work with an existing database schema.

Whether or not this mapping is poor design depends on the situation at hand and is generally in the eye of the beholder. If you have a number of concrete classes in a hierarchy with a large number of objects per class (read: a large number of rows in each table) *and* you only rarely need polymorphic access in your queries, then this mapping might actually be pretty good design.

Cheers,
Oliver
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the more appropriate Object Relational Mapping ORM forum. All JPA questions go there.

Thanks

Mark
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice response Oliver.

Yes, what happens if you have a legacy databse, you can't change the databse design, and this is how it is laid out. No choice, but have to use this mapping.

Mark
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks both of you, I've got it
In the spec, they could have made it mandatory for persistence providers then. I can't understand why they have decided to make it optional.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic