[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-613) search by criteria with sub-class Example do not bind sub-class properties
Paul Benedict (JIRA)
noreply at atlassian.com
Mon Mar 17 10:57:33 EDT 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29819 ]
Paul Benedict commented on HHH-613:
-----------------------------------
I'd like to know why this is correct behavior. I also am trying to perform sub-criteria on a polymorphic association. I really am looking for a particular type, and I have not read anywhere -- at least from what I can find -- why this isn't supported. Is it a technical limitation? A philosophical limitation? Time constraint?
> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list