[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-613?page=co...
]
Paul Benedict commented on HHH-613:
-----------------------------------
Ah. I see. If you create a criteria of the supertype and make an example of the subtype,
it obviously will not work. As Gavin said, this is correct behavior. You need to actually
create an example of the subtype.
search by criteria with sub-class Example do not bind sub-class
properties
--------------------------------------------------------------------------
Key: HHH-613
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-613
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.0.5
Reporter: Foaloke
Priority: Blocker
class Animal {
private Int age;
...
}
class Pet extends Animal {
private String name;
...
}
Pet pet = new Pet();
pet.setName("Fritz");
session.createCriteria(Animal.class).add(Example.create(pet)).list();
This will simply return all 'Pets', no binding occurs with the "name"
property of Pet.
This could, more probably, occurs if I have some Country which contains Animals & I
want to look for some kind of Pets in that country :
session.createCriteria(Country.class).createCriteria("animal").add(Example.create(pet)).list();
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira