-->
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.  [ 5 posts ] 
Author Message
 Post subject: several object as property
PostPosted: Thu Nov 27, 2003 7:23 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Hello,

i have following problem and don't really know, how i could realize this with hibernate!
i have to follow a specification so i couldn't really change the structure of what i'm trying to explain...

I have class JasBean contains several methods over a KeyValueTuple.
one method:
Code:
set(String key, Object value)


the KeyValueTuple is not part of the specification!
(i thought to handle this with in a one-to-many relationship from JasBean to KeyValueTuple with key and value as properties from KeyValueTuple)

but the Object value could be a String, a JasBean or a not yet defined class !

fe a JasBean could have a KeyValueTuple whose value is another JasBean which has a KeyValueTuple whose value is a.. Foo
Foo extends JasBean and could have a KeyValueTuple whose value is a .. String (that would be the end in this case)


if anybody could give me hints, how to handle this, i would be grateful
Johannes


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 4:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Have a read about the one-to-any mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 5:27 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
well, my problem is not the one-to-many relation.
is it, how to get the KeyValueTuple persistence, whose property value could be different objects(see above)!

???

a property couldn't be an object, or? musst be an basic type!?
do i have to write my own wrapper classes?

or did i overlooked something ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 6:36 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
ok, i've seen you coul have an object as property,
which should be persistent with two columns for id and classname of the object!
(we try this but in moment there were no database entries and no error messages too)

but what is, when the object is a String, the String has no id.. ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 7:16 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
in moment i would write a hibernate class fe HString with a "String property" and persist the HString instead of the String as Value from the KeyValueTuple !
Don't know if it is the most performand way, but it should work!?

i'm sorry if my thread was too trivial..
Johannes


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.