Bug 148 : problems querying property by class
Priority 
High
Reported Version 
 
Logged By 
imario
Status 
Fixed
Fixed Version 
2.1.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
08/09/2009
Updated 
08/09/2009
Type 
Bug
 
Attachments 
No attachments

The newly committed test
com.avaje.tests.singleTableInheritance.TestInheritQuery
contains two different ways to query a table with ManyToOne relationship.

1) List locations = Ebean.find(PalletLocation.class).where().eq("zone", zone).findList();
2) List locations = Ebean.find(PalletLocation.class).where().eq("zone.id", zone.getId()).findList();

The second style works, but the first one throws an exception.

The sql generated is wrong (notice the p.null=?):
select p.type, p.ID c0, pz.type c1, p.ZONE_SID c2, p.attribute c3
from pallet_location p
join zones pz on pz.ID = p.ZONE_SID
where p.null = ?


I tracked it down to the DeployPropertyParser where the "zone" property gets resolved but the elProp.getElPrefix() and elProp.getElPlaceholder() are both null.


Strange enough, with oracle it seems the PrepareStatement works (even with the wrong p.null column), but ebean then fails later when it tries to lookup a scalar type for the zone parameter when binding it. But this seems to be a consecutive fault.

 
Rob 09 Sep 11:48
Fixed in HEAD

Ok, added support for the ...

List locations = Ebean.find(PalletLocation.class).where().eq("zone", zone).findList();

Type of equals expression. Fixed in HEAD.

woResponse

Upload a file