-->
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: Join to a composite key with a constant (is this possible?)
PostPosted: Wed Dec 19, 2007 11:55 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
I have a legacy table Sale which references a legacy table Person.
The table Person has a composite key of personType and lastName.
The table Sale just has a lastName property,
it doesn't have a personType property because that's always the constant number 937.

I can easily set up the table of Person, but I can't create the association from Sale:

@ManyToOne
@JoinColumns ({
@JoinColumn(name="lastName", referencedColumnName = "lastName"),
@JoinColumn(name="937", referencedColumnName = "personType")
})
public Person getPerson() { //...


Is this actually solvable in Hibernate?

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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 22, 2007 5:22 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
With hibernate core you can use a formula. But it's not yet possible in hibernate annotations

_________________
Emmanuel


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.