[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-945) Query by example returns wrong entities
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Mar 21 13:00:32 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole closed HHH-945.
------------------------------
Closing stale resolved issues
> Query by example returns wrong entities
> ---------------------------------------
>
> Key: HHH-945
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-945
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: MySql 4.1
> Reporter: Mike
> Attachments: Customer.hbm.xml, Order.hbm.xml
>
>
> When querying for orders, the collection returned is a collection of customers, even though when the criteria is created it it is told that we want Orders.
> This worked under hibernate 2, and stopped working after upgrading.
> Example exampleOrd = Example.create(ord).excludeZeroes().enableLike(MatchMode.ANYWHERE)..ignoreCase();
> Example exampleCust = exampleCust = Example.create(cust).excludeZeroes().enableLike(MatchMode.ANYWHERE).ignoreCase();
>
> Criteria x = session.createCriteria(Order.class);
> x.add(exampleOrd);
> x.createCriteria("customer").add(exampleCust);
> List<Order> orders = x.list();
> This returns a List<Customer> when it should return a List<Order>. If I remove the example customer from the criteria, it returns a List<Order> as it should..
--
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