-->
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: JoinColumn with constant value ?
PostPosted: Fri Dec 07, 2007 3:10 pm 
Newbie

Joined: Tue Oct 04, 2005 3:30 am
Posts: 3
Hi,

please see the link
http://edocs.bea.com/kodo/docs41/full/h ... joins.html

Table T1 has column FK
Table T2 has column PK1 and PK2

I want create a ManyToOne relation, join column T1.FK to T2.PK1 and also want to specify that T2.PK2 has the value 'a'.

Can I achieve this by hibernate?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 8:11 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
I've tried several approaches on doing this, but hbm2ddl always fails on it - and I never got a chance to activate it.
Is it possible to disable hbm2ddl for a single class?

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 8:26 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
The classic hibernate manual mentions an interesting thing:


column and formula attributes may even be combined within the same property or association mapping to express, for example, exotic join conditions.

<many-to-one name="homeAddress" class="Address"
insert="false" update="false">
<column name="person_id" not-null="true" length="10"/>
<formula>'MAILING'</formula>
</many-to-one>

Apparently this isn't possible in annotations yet:
http://opensource.atlassian.com/project ... se/ANN-210

_________________
http://www.ohloh.net/accounts/ge0ffrey


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.