[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1513) Duplicated entities in a one-to-many select

Brad Davis (JIRA) noreply at atlassian.com
Wed Jul 14 15:28:15 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37795#action_37795 ] 

Brad Davis commented on HHH-1513:
---------------------------------

I've discovered an issue where an HQL query with two 'left join fetch' statements also triggers duplicated entities.  Is this considered to be covered under this same bug or would this be considered a separate issue?  Also, if you're going to say something is a FAQ it would be nice to have a pointer to said FAQ, especially now that the hibernate FAQ as a whole has dropped off the face of the earth.

> Duplicated entities in a one-to-many select
> -------------------------------------------
>
>                 Key: HHH-1513
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1513
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.0.5, 3.1.2
>         Environment: Oracle
>            Reporter: Tiago Rinck Caveden
>            Priority: Minor
>         Attachments: mappings.zip
>
>
> Using a criteria to obtain a full select on an class that has a one-to-many eager property returns duplicated entities.
> It seems it's making the returned list to have the same size of the result set returned by the join necessary to fetch the rows.
> Here's the code I'm executing:
> 		Session sessao = getSession();
> 		try {
> 			Criteria criterio = sessao.createCriteria(TipoErro.class);
> 			return criterio.list();
> 		} finally {
> 			releaseSession(sessao);
> 		}
> And here's the mapping of the one-to-many property:
> 		<set name="emailsNotificacao" inverse="true" lazy="false" fetch="join">
> 			<key column="ID_TIPO_ERRO" not-null="true" />
> 			<one-to-many
> 				class="com.matera.inss.entity.EmailNotificacao" />
> 		</set>
> I'll attach both the mapping of the parent entity, and of the child entity (don't know if it might help).
> Changing the use of the criteria by a find("from TipoErro") works perfectly.
> There's already a topic opened on the forum about this same issue, with more details and examples.
> Here's the topic: http://forum.hibernate.org/viewtopic.php?t=955186
> Thank you very much,
> Tiago.

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