-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate 3.6 classMetaData exposes composite-id class?
PostPosted: Wed Feb 01, 2012 8:17 pm 
Newbie

Joined: Mon Nov 07, 2011 9:13 pm
Posts: 3
Hi Hibernate experts

Say, my hibernate-mapping has the below entry

<class name="foo.Person" table="person" lazy="false">
<composite-id name="personid" class="foo.PersonId">
<key-property name="FIRST_NAME" type="string" column="FIRST_NAME"/>
<key-property name="LAST_NAME" type="string" column="FIRST_NAME"/>
</composite-id>
<property name="AGE" type="int" node="AGE" column="AGE"/>
</class>

Is there any way I could use org.hibernate.metadata.ClassMetadata or its subclasses like AbstractEntityPersister SingleTableEntityPersister to find the composite-id class name "foo.PersonId"? I though it should be easy but I just cannot find it even by examining the ClassMetaData object in debug mode. I could use getIdentifierPropertyName and getPropertyColumnNames to find personid and FIRST_NAME and LAST_NAME, but just cannot get the class name "foo.PersonId".

I notice org.hibernate.cfg.Configuration has getClassMappings and I could see the foo.PersonId is there, but I use Spring to initialize hibernate SessionFactory and I do not use cfg.xml, so I do not know how to get an instance of Configuration for my need.

Thanks for any advice in advance
Gerry


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

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.