[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7257) PersistentSet is initialized by criteria query with incomplete data

Peter Fodor (JIRA) noreply at atlassian.com
Tue Apr 17 13:45:48 EDT 2012


PersistentSet is initialized by criteria query with incomplete data
-------------------------------------------------------------------

                 Key: HHH-7257
                 URL: https://hibernate.onjira.com/browse/HHH-7257
             Project: Hibernate ORM
          Issue Type: Bug
          Components: query-criteria
    Affects Versions: 4.1.2, 3.5.5
         Environment: Hibernate 4.1.2 and 3.5.5
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
Ubuntu Linux 11.10
PostgreSQL 9.1, HSQLDB 2.2.8
            Reporter: Peter Fodor
         Attachments: hibernate-criteria-testcase.zip

A criteria query with a filter (to the elements of a one-to-many relation) can initialize the persistent set with so that it returns not all items.

More detailed description:
1a. A bean is a simple entity
1b. A bean has multiple B beans
2.  Query A bean with a filter to B
3a. The returns good result in the terms of A
3b. The set of returned A bean (which contains B instances) does not contains every referenced B item
4.  After querying A items again with session.get() the returned A instances neither have the full set (with every B reference)

Expected behavior:
1. The Set of A instances should contain every referenced B item. (I know it can not be done with one query in general case)
2. If I query the same items with session.get() it shouldn't be affected by previous query and its set should contain every item. (I think this is the most serious problem)
3. The PersistentSet shouldn't marked with initialized=true, if its content can not be guaranteed that it contains every item.

Note:
The set of the same query is different (and contains every item), if its PersistentSet is initialized in the same session by an other query. (e.g. with a previous session.get().toString())

For more detailed description please check the test case.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list