This is similar to the issue in Java Persistence with Hibernate where there is a one-to-many relationship from item to bid as well as a one-to-one relationship between them on successful bid. In section 8.1.2, "Arbitrary join conditions with formulas" the single row is identified by a single property, "SUCCESSFUL".
My situation is that I also have a one-to-many relationship between two tables but I need to restrict the many to a single, currently effective row which is determined by testing "eff_ts = exp_ts" on the many side. The columns involved are timestamps.
I've tried variations on the <properties> and <formula> tags specifying the 1:m surrogate key join and sql on the two columns in the same, single row but with no luck.
The sql would be: "select b.beta_id from alpha a, beta b where a.alpha_id = b.alpha_id and b.eff_ts = b.exp_ts"
I already have the set of b instances loading into the alpha object, I just need the single, current beta object of the set as a one-to-one mapping.
_________________ ... and this too shall be deprecated
|