-->
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: mapping of many table lines to one java object
PostPosted: Fri Jun 13, 2008 5:27 am 
Newbie

Joined: Fri Jun 13, 2008 5:04 am
Posts: 3
Hi,
I wonder, whether it is possible to map (writable and readable) many datasets (lines of a table in database) to one java-Object.

Database table:
Table_name (column_id, column_nr)
Datasets in table: (id_a, 1); (id_a, 2); (id_a, 3); (id_b, 4)

mapping java-Objects:
Object1:
ID: id_a ; setOfNr: {1,2,3}

Object2:
ID: id_b ; setOfNr: {4}

Is there any way for a mapping like this without any additional table in hibernate annotations?
I have a solution with one additional table and embed. This table has to store distinct ids (id_a,id_b).

Best regards
gimlitz


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 14, 2008 8:48 am 
Regular
Regular

Joined: Sun Apr 13, 2008 3:04 am
Posts: 71
Location: Bangalore
Don't think it is possible to do this without additional tables.. The reason being RDBMS each column can only have one value.

Regards,
Nagendra

_________________
Raja Nagendra Kumar,
C.T.O
http://www.tejasoft.com
TejaSoft - Specialists in Code Audit, Unit Testing and Merciless Re-factoring - Engineering Crisis Turnaround Experts


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 15, 2008 10:44 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Could you possible use an array in you Java code, and map that array to a @Lob in your database? Hibernate could then put in and pull out the array?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 17, 2008 7:27 am 
Newbie

Joined: Fri Jun 13, 2008 5:04 am
Posts: 3
Thanks for your answer. I suspect the same also.

Regards Wolfram


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 17, 2008 7:34 am 
Regular
Regular

Joined: Sun Apr 13, 2008 3:04 am
Posts: 71
Location: Bangalore
One note here is using LOB would make your data non searchable as this is no more treated as text but as binary..

I am sure u must be already aware of this.

Regards,
Nagendra

_________________
Raja Nagendra Kumar,
C.T.O
http://www.tejasoft.com
TejaSoft - Specialists in Code Audit, Unit Testing and Merciless Re-factoring - Engineering Crisis Turnaround Experts


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 17, 2008 7:39 am 
Newbie

Joined: Fri Jun 13, 2008 5:04 am
Posts: 3
Thanks for the Idea using LOBs, but this will not be a solution in my case.

Regards Wolfram


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.