[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2374) setFetchMode() ignore incorect path

Baptiste MATHUS (JIRA) noreply at atlassian.com
Mon Jan 22 09:37:44 EST 2007


setFetchMode() ignore incorect path
-----------------------------------

         Key: HHH-2374
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2374
     Project: Hibernate3
        Type: Bug

    Versions: 3.2.0.ga    
 Environment: All DB I guess
    Reporter: Baptiste MATHUS


This bug report is in fact a copy of the one that was already present in H2 : http://opensource.atlassian.com/projects/hibernate/browse/HB-763 . It does not seem to have changed in H3.

When calling setFetchMode("path", FetchMode.JOIN) on a criteria, even if the path is not correct, Hibernate does not complain. Its behaviour seems to be to simply ignore this bad path. I guess this should throw an exception. In fact, the bad thing of ignoring bad path is that if the developer was wrong specifying the path (typo, for example), then the join simply won't happen :-/.

I wrote a very simple testcase :
	public void testFindClients()
	{
		Session session = HibernateUtil.currentSession();
		session.beginTransaction();

		Client c = (Client)session.createCriteria(Client.class).setFetchMode("foo", FetchMode.JOIN)
				.setFetchMode("foo.bar", FetchMode.JOIN).uniqueResult();
		session.getTransaction().commit();
	}

My Client class has some relationships with other classes, but obviously none named "foo". The code above just issue the following select : 
    select
        this_.ID as ID0_0_,
        this_.nom as nom0_0_,
        this_.prenom as prenom0_0_,
        this_.age as age0_0_ 
    from
        Client this_

Thanks again for your great work, guys!

-- 
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