-->
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.  [ 3 posts ] 
Author Message
 Post subject: I want to know how to find column name from a property?
PostPosted: Tue Jul 20, 2004 1:06 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: Tue Jul 20, 2004 10:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
cfg.getClassMapping(Foo.class).blah.blah.blah


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 11:04 pm 
Newbie

Joined: Mon Nov 10, 2003 12:56 am
Posts: 3
in fact,I had reached this point,but I really do not konw what the next step?

invoke getTable() or getMetaAttribute()?

and the next further?


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