-->
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: How to find out which attribute is used as PK
PostPosted: Tue Jun 08, 2010 5:59 am 
Newbie

Joined: Fri Apr 02, 2010 8:40 am
Posts: 9
Hi all,

is there any way how to find out which attribute of hibernate mapped class is used as primary key ?

e.g

<hibernate-mapping>
<class name="Component" table="component" schema="public">
<id name="id" type="string">
<column name="id" length="36" />
<generator class="uuid" />
</id>
<many-to-one name="component" class="Component" fetch="select">
<column name="parent_id" length="36" />
</many-to-one>
</class>
</hibernate-mapping>

in this case primary key is id attribute as I'm using generator class for this.

Is there some other attribute I've to add to mapping in order to hibernate recognize that it's primary key ?

I've tried ClassMetadata.getNaturalIdentifierProperties() but it returned empty list ... any ideas ??

thanks


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.