Regular |
|
Joined: Thu Oct 13, 2005 4:19 am Posts: 98
|
I have a legacy database with a table X and a table Y.
There's a constraint between X and Y on X.code and Y.code.
There multiple Y's with the same code.
A Y.code together with Y.region is unique.
I'd like to make a @OneToOne relation from X to Y, with the where clause constraints "X.code = Y.code" and "Y.region = :myRegion", which guarantees that X to Y is a *ToOne relation. That ":myRegion" is a runtime parameter.
However it looks like it's impossible to map X to Y as a *ToOne relation in JPA-Hibernate because at configuration time it can't see that it's a ToOne relation? Or is it possible?
Thanks for any help :)
_________________ http://www.ohloh.net/accounts/ge0ffrey
|
|