-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: “Found two representations of same collection"
PostPosted: Tue May 05, 2009 8:35 am 
Newbie

Joined: Tue May 05, 2009 8:32 am
Posts: 4
Any solutions for: “Found two representations of same collection" error.

Thanks !


Top
 Profile  
 
 Post subject: Re: “Found two representations of same collection"
PostPosted: Tue May 05, 2009 11:35 am 
Regular
Regular

Joined: Wed Jun 20, 2007 1:53 am
Posts: 75
post your hibernate mapping file(.xml) and code between session..


Top
 Profile  
 
 Post subject: Re: “Found two representations of same collection"
PostPosted: Tue May 05, 2009 11:47 am 
Newbie

Joined: Tue May 05, 2009 8:32 am
Posts: 4
I am getting the below error:
“Error while saving customer: Found two representations of same collection: com.core.model.impl.ContactInfoImpl.contactTypeDetails”

[classes are: ContactInfo and ContactInfoDetails]

code from hbm files:

In Parent class:
<hibernate-mapping package="com.beacon.core.model.impl" default-lazy="true" default-cascade="all-delete-orphan">
<class name="ContactInfoImpl" table="CONTACT_INFO">

<bag name="contactTypeDetails" inverse="true">
<key column="CONTACT_INFO_ID"/>
<one-to-many class="ContactTypeDetailImpl"/>
</bag>
</class>
<query name="com.core.model.impl.ContactInfoImpl.select.all">
<![CDATA[
from com.core.model.impl.ContactInfoImpl as entity
]]>
</query>


and the child class:
<hibernate-mapping package="com.core.model.impl" default-lazy="true" default-cascade="all-delete-orphan">
<class name="ContactTypeDetailImpl" table="CONTACT_TYPE_DETAIL" >

<many-to-one
name="contactInfo"
column="CONTACT_INFO_ID"
class="ContactInfoImpl"
not-null="false"
/>

<query name="com.core.model.impl.ContactTypeDetailImpl.select.all">
<![CDATA[
from com.core.model.impl.ContactTypeDetailImpl as entity
]]>
</query>

we weren’t doing manual session management ! Looks like it is a cascase issue with reference to another post: http://www.damnhandy.com/2008/08/20/hib ... ion-error/

But the cascade in the mapping file is :default-cascade="all-delete-orphan"

Not sure which piece needs a fix?

Your help is very much appreciated !


Top
 Profile  
 
 Post subject: Re: “Found two representations of same collection"
PostPosted: Tue May 05, 2009 12:04 pm 
Newbie

Joined: Tue May 05, 2009 8:32 am
Posts: 4
additional information to the above post:

ContactInfo contains ContactTypeDetail
ContactTypeDetail contains PartyContactDetail
PartyContactDetail contains PartyDetail

PartyContactDetails hbm:
-------------------------

hibernate-mapping package="com.core.model.impl" default-lazy="true" default-cascade="all-delete-orphan">
<class name="PartyContactDetailImpl" table="PARTY_CONTACT_DETAIL">

<many-to-one
name="partyDetail"
column="PARTY_DETAIL_ID"
class="PartyDetailImpl"
not-null="false"
/>

<bag name="contactTypeDetails" inverse="true" cascade="all-delete-orphan">
<key column="PARTY_CONTACT_DETAIL_ID"/>
<one-to-many class="ContactTypeDetailImpl" />
</bag>

</class>


<query name="com.core.model.impl.PartyContactDetailImpl.select.all">
<![CDATA[
from com.core.model.impl.PartyContactDetailImpl as entity
]]>
</query>



PartyDetail hbm:
------------------
<hibernate-mapping package="com.core.model.impl" default-lazy="true" default-cascade="all-delete-orphan">
<class name="PartyDetailImpl" table="PARTY_DETAIL">


<many-to-one
name="partyDetailType"
column="PARTY_DETAIL_TYPE_ID"
class="AttributeValueImpl"
not-null="false">


<bag name="partyContactDetails" inverse="false" >
<key column="PARTY_DETAIL_ID"/>
<one-to-many class="PartyContactDetailImpl"/>
</bag>
<bag name="contactTypeDetails" inverse="false" >
<key column="PARTY_DETAIL_ID"/>
<one-to-many class="ContactTypeDetailImpl"/>
</bag>

</class>


Top
 Profile  
 
 Post subject: Re: “Found two representations of same collection"
PostPosted: Wed May 06, 2009 11:10 am 
Regular
Regular

Joined: Wed Jun 20, 2007 1:53 am
Posts: 75
Hi

I assumed that this seems you are updating the collection after clearing the session.

there is workaround for this, you can find that in the same forum using below link

viewtopic.php?p=2231400

Good luck..


Top
 Profile  
 
 Post subject: Re: “Found two representations of same collection"
PostPosted: Wed May 06, 2009 11:17 am 
Newbie

Joined: Tue May 05, 2009 8:32 am
Posts: 4
Thanks for the reply.

I will post the result, if I am able to resolve the issue ;)


Top
 Profile  
 
 Post subject: Re: “Found two representations of same collection"
PostPosted: Mon May 18, 2009 11:48 am 
Regular
Regular

Joined: Wed Jun 20, 2007 1:53 am
Posts: 75
have you resolved an issue?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.