Bug 347 : ClassCastException with lazy loaded Inheritance instance
Priority 
High
Reported Version 
 
Logged By 
mschmitt
Status 
Fixed
Fixed Version 
2.7.3
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
13/01/2011
Updated 
13/01/2011
Type 
Bug
 
Attachments 
No attachments

lazy Loading of a field with inheritance throws a ClassCastException:

public class Customer {
@ManyToOne(cascade = CascadeType.ALL)
private Vehicle vehicle;
}

public class Truck extends Vehicle {
int capacity;
}

if (customer.getVehicle() instanceof Truck) {
(Truck) customer.getVehicle()).getCapacity());
}
throws:


Caused by: java.lang.ClassCastException: db.data.Truck$$EntityBean$ora cannot be cast to db.data.Vehicle$$EntityBean$ora

More info and an example code can be found under:
https://groups.google.com/forum/?hl=de#!topic/ebean/8kO88_0VpfA

 
woResponse

Upload a file