[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-2179) Criteria query return repeated objects when quering for an object with Lazy one to many association
Christian Bauer (JIRA)
noreply at atlassian.com
Wed Oct 25 15:19:05 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2179?page=all ]
Christian Bauer resolved HHH-2179:
----------------------------------
Resolution: Rejected
This is an FAQ, use the forum for usage questions.
> Criteria query return repeated objects when quering for an object with Lazy one to many association
> ---------------------------------------------------------------------------------------------------
>
> Key: HHH-2179
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2179
> Project: Hibernate3
> Type: Bug
> Components: query-criteria
> Versions: 3.2.0.cr2
> Environment: Windows, HSQLDB, Hibernate Annotations
> Reporter: Lucas Machado
> Attachments: testVersao.rar
>
>
> In the above scenario:
> ClassA (1) -- (*) ClassB
> to implement this we we have the following annotation in ClassA.
> @OneToMany( cascade = CascadeType.ALL, fetch=FetchType.EAGER)
> public Set<ClassB> getBs(){
> ....
> }
> in the database we have 1 row representing ClassA and 3 rows representing ClassB (associated with the unique ClassA)
> The problem is:
> If we query for
> "from ClassA"
> returns 1 instance of ClassA as expected
> if we repeat the query using Criteria
> Criteria crit = session.createCriteria(ClassA.class);
> List<ClassA> l = crit.list();
> The result is a list with 3 positions filled by the same instance of ClassA.
> If we change the FetchType to Lazy the problem is solved
> Attached is a sample maven-eclipse project with a test case
--
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