This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mapping Inheritance - What is a UNION Join in hibernate or SQL ?  RSS feed

 
Ali Gordon
Ranch Hand
Posts: 182
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Chapter 16, page 311, the book "Hibernate Made Easy" by Cameron McKenzie says that -


In the JOINED inheritance type, tables only maintain data that map directly to the properties in the associated class. Subclasses are then linked to their
inherited properties through common primary key fields in the tables, linking as UNION joins at runtime.


What is the query for this UNION join in, say SQL server ?

To make the sample SQL query, take the example - Parent Class table {id, lastName}, Child Class table{id, firstName}
Here id, is the auto generated id made by hibernate. lastName and firstName are private Strings in their respective classes.

Thanks.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36634
475
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think he means you do a union of two (or more queries) that have joins in them. (not sure though)

For example,
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!