-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to get the composite identifiers class name in runtime
PostPosted: Sat Aug 20, 2005 5:20 am 
Newbie

Joined: Sat Aug 20, 2005 5:14 am
Posts: 9
Hi all,

How can i get the composite identitfier class name at runtime?

For example, in the *.hbm.xml, I specified ProductDetail$PK as the class for ProductDetail. Can I get this class name at runtime?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 20, 2005 1:07 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Use org.hibernate.cfg.Configuration.getClassMappings() and/or getCollectionMappings() to get the org.hibernate.mapping.PersistentClass. Then call PersistentClass.getIdentifierProperty() and use a class loader .


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 11:09 pm 
Newbie

Joined: Sat Aug 20, 2005 5:14 am
Posts: 9
dennisbyrne wrote:
Use org.hibernate.cfg.Configuration.getClassMappings() and/or getCollectionMappings() to get the org.hibernate.mapping.PersistentClass. Then call PersistentClass.getIdentifierProperty() and use a class loader .



Thanks alot !!

Although this only return the "name" of the composite-id, but i can use the reflection api to find the exact class name.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 11:12 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Forget to rate?


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