[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3943) Criteria fails to search ManyToMany associations while setCacheable is true

TK Kocheran (JIRA) noreply at atlassian.com
Wed Jun 3 19:02:13 EDT 2009


Criteria fails to search ManyToMany associations while setCacheable is true
---------------------------------------------------------------------------

                 Key: HHH-3943
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3943
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.3.1
         Environment: MySQL 5, Hibernate 3.3.1
            Reporter: TK Kocheran


When using the Criteria API to search for values in ManyToMany associations, if setCacheable is true, Hibernate will fail to find certain objects. I have confirmed this problem both when using unidirectional and bidirectional ManyToMany associations. The scenario kind of looks like this:

@Entity @Table(name='group')
public class Group {
        ...
        @ManyToMany(targetEntity=User.class)
        @JoinTable(name="group_members")
        private List<User> members;
        ...
}

When searching for specific groups, I will often form criteria like this:

Criteria criteria = session.createCriteria(SupportGroup.class)
        .setTimeout(10)
        .setCacheable(true)
        .createAlias("members", "members")
        .add(Restrictions.eq("members.username", "tomSawyer"));

Executing this criteria will fail to retrieve any results. Only when setCacheable is set to false will results be returned. (I have confirmed through other means that I can get access to the entities matching these restrictions)

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