File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Mapping in Hibernate for nested Bean Structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Mapping in Hibernate for nested Bean Structure" Watch "Mapping in Hibernate for nested Bean Structure" New topic

Mapping in Hibernate for nested Bean Structure

Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Hi All,

I have a bean, which in-turn have one more bean in it. I am showing my mapping for parent bean in Hibernate. But I am not sure how to create a mapping for nested bean element.

And nested class Event is

Now here is my mapping for Person class.
If I had not Event in Person class the below mapping would have been perfect for Person class individually.

Now here is my problem, If I want to map modified Person bean(which have Event variable in it), how do I map this class for hibernate??

Please let me know, if anything is no clearly mentioned.

The Best way to predict your future is to create it - Every great individual common man
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
It is called a "one-to-one association", with an example here.
Don't get me started about those stupid light bulbs.
subject: Mapping in Hibernate for nested Bean Structure
Similar Threads
Read/Write BLOB in byte[] with Hibernate in MySQL..
inverse=true in many-to-many doubt
Mapping Exception
Question on Unidirectional Association
Object filtering in Hibernate from Database