-->
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.  [ 3 posts ] 
Author Message
 Post subject: Howto get the value of "class" in one-to-many bloc
PostPosted: Wed Feb 11, 2004 6:48 pm 
Newbie

Joined: Wed Feb 11, 2004 6:04 pm
Posts: 11
Location: Houston
I feel stupid asking this but can't find a way ...

as part of my mapping file I have the block

<set
name="naDsUsers"
inverse="true"
>
<key>
<column name="ORGANIZATION_S" />
</key>
<one-to-many
class="com.xyz.abc.model.NaDsUser"
/>
</set>

Now I have in Java the textstring "naDsUsers" and the ClassMetadata for the object having this as a one-to-many in my hand - nothing else. And I would like to get the value of "class", i..e the String "com.xyz.abc.model.NaDsUser" - HOW ?. I have sloved this for many-to-one relations since there I can get from the property the Type and via the type I can to type.getName() which would return the value. In this case it would return java.util.Set but that's not what I am looking for.

One option I tried is to go via the Configuration and do a getCollectionMappings and from there via Collection with no luck. Also I tried to call getCollectionMapping for a given role - but what is a role ?

Hope any can tell me that I should RTFM or give me a nice hint ....

Thanx

_________________
B-)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 11, 2004 6:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use sessionFactory.getCollectionMetadata() - the role name should be <full class name>.<attribute name>

e.g when your class containg the set mapping is de.something.Foo, the role name would be "de.something.Foo.naDsUsers"


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 11, 2004 7:10 pm 
Newbie

Joined: Wed Feb 11, 2004 6:04 pm
Posts: 11
Location: Houston
U are a Star !

I was that route before but gave up but of course, .. using

CollectionMetadata colm = _sessFactory.getCollectionMetadata(_dataClass+"."+childEntity);
String theoneIwasLookingFor = colm.getElementType().getName());

Thanx !

_________________
B-)


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