[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5526) Dirty Entity instances in session after HQL queries with where conditions on OneToMany relation

Felix von Delius (JIRA) noreply at atlassian.com
Thu Sep 2 11:31:19 EDT 2010


Dirty Entity instances in session after HQL queries with where conditions on OneToMany relation
-----------------------------------------------------------------------------------------------

                 Key: HHH-5526
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5526
             Project: Hibernate Core
          Issue Type: Bug
          Components: core, query-hql
    Affects Versions: 3.3.2
         Environment: Hibernate 3.3.2.GA, Java 1.6
            Reporter: Felix von Delius


Having a OneToMany relation on Team.persons, after you execute a HQL query in the form

    "select distinct t from Team t join fetch t.persons p where p.id = ?"

the selected Team instance only contains the one person with the id searched for (i.e. missing other persons in this team).

Probably this could be worked around by changing the query, the main problem ist that this broken Team instance is attached in the session and querying for the team by it's id returns this broken team:

Team newTeamFetchedById = session.get(Team.class, TEAM_ID); // team id from the query above

Evicting the fetched team and repeating the query again fetches a team with the correct number of persons.



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