-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Multiple Objects (and their data) to Single Table?
PostPosted: Wed Jan 25, 2006 2:15 pm 
Newbie

Joined: Thu Jan 19, 2006 8:24 pm
Posts: 5
Hibernate: 3.1.1
Database: MySQL 5.0.18

Can Hibernate map multiple objects (and their data) to a single table? If so, how?

My Java object contains ints, strings, along with other custom Java objects. I have been successful in mapping the inner objects to tables, setting up their relationships and extracting everything fine, however this method is against the required database schema I am to use.

I have yet to find any information supporting this.

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 2:33 pm 
Newbie

Joined: Thu Jan 19, 2006 8:24 pm
Posts: 5
... and with my finally posting to the forums, I believe I have stumbled across my answer.

http://www.developer.com/java/other/article.php/10936_3559931_5

However, any additional insight on this will be greatly appreciated.

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 2:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
perhaps you can be more specific as I, for one, do not understand what it is you are working with or trying to acheive; thus hard to know where to start ;)

Are these multiple *classes* in an inheritence hierarchy? That's what the link you posted is talking about.

Sounds like this is an existing table structure... If so, what does this table look like? Does it contain discrimination information?

Do these "custom Java objects" represent associations to other tables? Or are they simply transformed or aggregated information from the table in question?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 3:02 pm 
Newbie

Joined: Thu Jan 19, 2006 8:24 pm
Posts: 5
I'll describe the object structure...

Info:
String name
Address address
ContactInfo contactInfo

Address:
String address1
String city
String state
String zip

ContactInfo:
String email
String phone

The table I am working with is an Info table, with columns for all the String information of these three objects.

As for discrimination information, being new to this, I just threw in the discrimination style from the link I posted earlier.

I hope this clears it up a little bit.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 3:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
So it sounds like what you are looking for is termed 'components':
http://www.hibernate.org/hib_docs/v3/reference/en/html/components.html#components-dependentobjects


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 3:19 pm 
Newbie

Joined: Thu Jan 19, 2006 8:24 pm
Posts: 5
steve,

Components is what I needed.

Thank you for your assistance in finding this information.

-kw


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.