-->
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.  [ 1 post ] 
Author Message
 Post subject: shared references to a collection exception on self join
PostPosted: Thu Jul 26, 2012 5:25 am 
Newbie

Joined: Thu Jul 26, 2012 5:19 am
Posts: 2
I recently updated all my transaction definitions in spring to use annotations. Since, I've been getting an unusual exception whilst left joining onto the same entity. This occurs on the next (unrelated) call to hibernate. I'm guessing that previously the session was much shorter lived than now, therefore the object was detached from the session, preventing this flush.

Exception

Code:
Found shared references to a collection: com.traveljigsaw.pricing.businessObjects.TacticalPriceRule.experiments
org.hibernate.HibernateException: Found shared references to a collection: com.traveljigsaw.pricing.businessObjects.TacticalPriceRule.experiments
    at org.hibernate.engine.Collections.processReachableCollection(Collections.java:185)
    at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:60)
    at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:122)
    at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:83)
    at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:77)
    at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:165)
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
    at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58)
    at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1185)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1261)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
    at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:890)
    at com.traveljigsaw.pricing.dao.impl.BarrierDateDaoImpl.resolve(BarrierDateDaoImpl.java:84


Mapping

Code:
<hibernate-mapping>
<class name="com.traveljigsaw.pricing.businessObjects.TacticalPriceRule" table="TacticalPriceRule">
<id name="idTacticalPriceRule" type="java.lang.Integer">
    <column name="idTacticalPriceRule"/>
    <generator class="identity"/>
</id>

<property name="idExperiment" type="java.lang.Integer">
    <column name="idExperiment" not-null="false" />
</property>

<set fetch="select" inverse="false"  name="experiments">
    <key property-ref="idExperiment">
    <column name="idExperiment" not-null="false"/>
    </key>
    <one-to-many class="com.traveljigsaw.pricing.businessObjects.TacticalPriceRule"/>
</set> ...


HQL Query

Code:
select TPR from TacticalPriceRule as TPR
left join fetch TPR.experiments as TPRE
where TPR.variant is null or TPR.variant = 'A'


Any ideas or hints would be much appreciated,

Thanks,

Dan


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

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.