Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Metamodel]How to get column name(foreign key)from Property?
PostPosted: Mon May 07, 2012 11:04 am 
Newbie

Joined: Fri Jun 08, 2007 3:08 am
Posts: 8
Hi !

I use an entity name to retrieve a PersistentClass.
Thanks to a given attribute name, I could retrieve a Property from this PersistentClass.
This property is mapping a foreign key, so I try to find out the corresponding colum name.

With property.getValue().getColumnIterator(), I get it for an aggregation link @ManyToOne.
But the iterator has no element in case of @OneToOne.

For an association, I'm try to find it out by an other way.
I use a the Table.getForeignKeyIterator() and with foreignKey.getReferencedEntityName() I check if it is the associated Entity i'm looking for.

I know this is not the right way...
How could I find out the column name of a property which is mapping a foreign key ?


I use a Configuration instance to get the Property and PersistentClass.


Thanks !!!


Top
 Profile  
 
 Post subject: Re: [Metamodel]How to get column name(foreign key)from Property?
PostPosted: Fri May 11, 2012 4:12 am 
Newbie

Joined: Fri Jun 08, 2007 3:08 am
Posts: 8
Any idea ?

Thx!


Top
 Profile  
 
 Post subject: Re: [Metamodel]How to get column name(foreign key)from Property?
PostPosted: Thu May 31, 2012 9:54 am 
Newbie

Joined: Fri Jun 08, 2007 3:08 am
Posts: 8
The property was on the "mapped side".
I get the column name from the non-mapped side.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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.