-->
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: How to find column name from a property?
PostPosted: Thu Jul 15, 2004 4:59 am 
Newbie

Joined: Mon Nov 10, 2003 12:56 am
Posts: 3
I want to know how to find column name from a property at runtime?

for example:

<class name="com.aaa.Subject" table="TB_SUBJECT">
<id column="SJ_ID" name="id" type="long">
<generator class="assigned"/>
</id>
<property column="SJ_NAME" length="100" name="name" not-null="true" type="string"/>
</class>


public interface A {
public String getColumnName(Class bean,String propertyName);
}

public class B {
public void main(String[] d) {
A a = getA();//do not care how to get
System.out.println(a.getColumnName(Subject.class,"name"));
}
}

can you write a class implemented A that can get result as "SJ_NAME"?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 6:29 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
Maybe the following chapter will be helpful 9.10. Metadata API
http://www.hibernate.org/hib_docs/reference/en/html/manipulatingdata.html#manipulatingdata-metadata

--
Leonid


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.