Bug 268 : ManyToOne association to an Entity with an embedded id the column order is mixed up.
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.6.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
08/04/2010
Updated 
08/04/2010
Type 
Bug
 
Attachments 
No attachments

Hi,

More embedded id's issues.

In a ManyToOne association to an Entity with an embedded id the column order is mixed up. In one case it's determined by the order of the property's in the class in the other case the order is determined by the order the JoinColumns are defined.

When these don't match up you will get an entity where the id columns contain the wrong values. In our case the columns where both strings so we didn't get any errors until we wanted to load the object again (not found).

We fixed it by sorting the property list, it's a quick and dirty solution to demonstrate the problem. See the patch attached (BeanPropertyAssoc class).

Cheers,

Rien

 
Rob 08 Apr 22:00
Ok, adding a int position to the ImportedIdSimple ...

I think a simple way to sort would be to add a int position to ImportedIdSimple, and use that as the basis of the sorting.

Rob 08 Apr 22:20
Fixed in HEAD

Will need to get confirmation as I don't have a current test case for this issue.

woResponse

Upload a file