[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3524?page=c...
]
Richard Ogin commented on HHH-3524:
-----------------------------------
I found a workaround to the problem: specify the joinType as LEFT_OUTER_JOIN when creating
a sub-criteria (the default was INNER_JOIN for 3.2.6.ga).
Example:
rootCriteria.createCriteria("foos",
org.hibernate.sql.JoinFragment.LEFT_OUTER_JOIN).add( Restrictions.eq("bar",
barValue) );
rootCriteria.setFetchMode("foos", FetchMode.JOIN);
setFetchMode ignored if using createCriteria
--------------------------------------------
Key: HHH-3524
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3524
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, Oracle 8
Reporter: Peter Weemeeuw
Attachments: test.case.tar.gz
Hi,
It seems that criteria.setFetchMode gets ignored if you combine it with createCriteria to
add a restriction.
This works as expected:
DetachedCriteria c = DetachedCriteria.forClass(MenuItem.class);
c.setFetchMode("menuItemSubscriptions", FetchMode.JOIN);
But in this case the join doesn't happen (and I get a LazyInstantiationException
further on).
DetachedCriteria c = DetachedCriteria.forClass(MenuItem.class);
c.setFetchMode("menuItemSubscriptions", FetchMode.JOIN);
c.createCriteria("menuItemSubscriptions").add(
Restrictions.eq("location", "B")
);
This does not happen if I set lazy="false" in the mappings
file.
Regards,
Peter
--
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