This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Mapping two tables to one persistent class in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Mapping two tables to one persistent class in hibernate" Watch "Mapping two tables to one persistent class in hibernate" New topic
Author

Mapping two tables to one persistent class in hibernate

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 417
Can we map two tables with one persistent class in hibernate?

If yes, please let me know how can we do that.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Something like this:


You end up with a class mapped like this:



Here's a little tutorial on the topic:

Mapping One Class to Two Tables

-Cameron McKenzie

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mapping two tables to one persistent class in hibernate
 
Similar Threads
Extra column created
One java class & Two tables Hibernate
Hibernate Join(ORM)
spring : bind path=" "
How to persist an object in Hibernate