-->
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.  [ 2 posts ] 
Author Message
 Post subject: What class of the Hibernate Core return the name of primary?
PostPosted: Fri Jun 27, 2008 1:17 pm 
Newbie

Joined: Tue Jul 12, 2005 2:46 pm
Posts: 13
Location: BS2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.2.2 GA

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.wealthsystems.sim.model.entity">
<class name="Pais" table="PAIS">
<id name="idPais" column="IDPAIS" type="long"></id>

<property name="sigla" not-null="true" length="10"/>
<property name="descricao" not-null="true" length="80"/>
<property name="nacionalidade" length="80" />
<property name="idnAtivo" not-null="true" type="byte" />
<property name="idnPaisPadrao" type="byte" />
<property name="codigo" length="20" />

</class>
</hibernate-mapping>


In this moment i need discover what property of my entity is primary key.

I Write a method getPrimaryKeyProperty, but i donĀ“t know how to discover what property is my primary key in run time execution.
public String getPrimaryKeyProperty(){}

Any one, say me what class of the Hibernate Core answer my question.

What class of the Hibernate Core return the name of primary key of the entity?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 04, 2008 10:25 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
I'm not sure of the context of the situation? Why can't you just call getId?

What is the context of this scenario. Maybe it can shed some more light on your problem?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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