Bug 244 : Problems using field of embedded object in order by
Priority 
High
Reported Version 
 
Logged By 
imario
Status 
Fixed
Fixed Version 
2.5.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
15/03/2010
Updated 
15/03/2010
Type 
Bug
 
Attachments 
No attachments

I've committed a test method to TestCore called "testEmbeddedWithOrder" which demonstrates a failure when using a field of an embedded object in the order by clause.

I've added the auditInfo property to the Item which is of type AuditInfo and uses the AttributeOverride annotation.

Now, when doing

List items = getServer().find(Item.class).order("auditInfo.created asc, type asc").findList();

the generated sql looks like this

select i.customer c0, i.itemNumber c1, i.description c2, i.units c3, i.type c4, i.region c5, i.version c6, i.DATE_MODIFIED c7, i.DATE_CREATED c8, i.MODIFIED_BY c9, i.CREATED_BY c10, i.customer c11, i.type c12, i.customer c13, i.region c14
from item i
order by i.created, i.type

as you can see, the column name in the order by clause for the "created" column is wrong. It should be "i.DATE_CREATED".

 
Rob 15 Mar 23:26
Fixed in HEAD

Fixed in HEAD.

woResponse

Upload a file