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.  [ 7 posts ] 
Author Message
 Post subject: [Pb with composite id] How to get the name of key property?
PostPosted: Thu Feb 01, 2007 1:07 pm 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
Hi everyone,
here is my problem :

<composite-id
name="id">
<key-property name="operationId"/>
<key-property name="requestId"/>
</composite-id>

I need to access in my code to the names of the key property
i.e "operationId" & "requestId"


In fact i need them to display a datatable in JSF.

The only thing i did for the moment is :

SingleTableEntityPersister metadata = (SingleTableEntityPersister) sessionFactory.getClassMetadata(table);

String[] identitfierNames = metadata.getIdentifierColumnNames(); =>>return columns names
String identifierproperty =metadata.getIdentifierPropertyName();
=>>return composite id name...(here it's "id")

I really don't find how to get the name of these key property...
If anyone can help...
Thx


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 4:49 am 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
anybody?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 5:33 am 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
Can you try
String[] propNames = metadata.getSubclassPropertyColumnNames("id");

id being the primary column name in the above call.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 6:31 am 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
I have just tried it returns the name of the columns... not the name of the properties

<composite-id name="id" class="OperationId">
<key-property name="requestId" type="string">
<column name="REQUEST_ID" length="30" />
</key-property>
<key-property name="opId" type="string">
<column name="OP_ID" length="30" />
</key-property>
</composite-id>

So in my case it returns, "REQUEST_ID" & "OP_ID"
whereas i need to get "requestId" & "opId"


Thx for helping anyway


Top
 Profile  
 
 Post subject: here
PostPosted: Fri Feb 02, 2007 6:35 am 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
Maybe i found a solution with the method :

PersistentClass.getIdentifierMapper()

But i can't find how to get or instanciate my Persistent Class...
I found nothing which returns a PersistentClass.
And i cannot instanciate from the full name of my class...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 03, 2007 5:13 am 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
nobody knows?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 4:57 am 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
Please anybody???????


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