-->
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: define property in .hbm file that is not column is database
PostPosted: Mon Sep 25, 2006 3:33 am 
Newbie

Joined: Mon Sep 19, 2005 3:08 am
Posts: 19
Is there a way to define some property in .hbm file that is not column is database and later use value of that property in join assoications.

e.g. Test.hmb
...
<property name="issueStatusId" type="integer">
<column name="ISSUE_STATUS_ID" not-null="true" />
</property>

<property name="languageId" type="integer"/>

...

<many-to-one name="translatedIssueStatus" property-ref="translatedNomItemJoin" >
<column name="ISSUE_STATUS_ID" />
<formula>languageId</formula>
</many-to-one>
...
languageId is just a property (not a column) that I need to set from java code, and than when I set languageId from code, I will call getTranslatedIssueStatus() that will use value of languageId to make a select from database.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 8:12 am 
Newbie

Joined: Mon Sep 19, 2005 3:08 am
Posts: 19
This is not dificult question. Does anybody know?
Is it possible?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 8:23 am 
Regular
Regular

Joined: Mon May 08, 2006 6:00 am
Posts: 53
Location: India
You cant have any property which is not present as a column in that table.....as Hibernate will validate all the mappings which you define in your hbm at the start up. If it finds any property w/o mapping to a column, it shall screame.

In short you can have anything extra in your POJO, but not in your HBM

Sudhir


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.