• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[EJB3] Table per Concrete Class Strategy

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 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 ?
 
Oliver Kamps
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac 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
Sheriff
Posts: 17278
6
IntelliJ IDE Mac 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 Ubuntu VI Editor
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic