-->
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: Problem with cached collections after removal of an entitiy
PostPosted: Mon Jul 20, 2009 8:10 am 
Newbie

Joined: Mon Jul 20, 2009 7:44 am
Posts: 1
Hey,

following problem( with a cache strategy for all classes and collections):

We have two tables mapped to classes PropertyGroupHibData and PropertyHibData.
PropertyGroupHibData has a collection to PropertyHibData( Resolves a 1-N Relation).

Code:
<hibernate-mapping>
   <class
      name="PropertyGroupHibData"
      table="PropertyGroups">
      <id
         name="propertyGroupID"
         type="long">
         <generator class="native"/>
      </id>
      <set name="properties" inverse="true" >
         <key column="propertyGroupID"/>
         <one-to-many class="PropertyHibData"/>
      </set>
   </class>
</hibernate-mapping>



Code:
<hibernate-mapping>
   <class
      name="PropertyHibData"
         table="Properties">
      <id
         name="propertyID"
         type="long">
         <generator class="native"/>
      </id>
      <many-to-one name="propertyGroup" column="propertyGroupID"
         class="PropertyGroupHibData"
         />   
   </class>
</hibernate-mapping>


When I now query a element of PropertyGroup, than delete a Property from this PropertyGroup and afterwards query the PropertyGroup again I get the following exception:
Code:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [PropertyHibData#34]


We used to resolve this by removing the PropertyHibData from all collections it could be contained in. But I now have the question if there is no better way of resolving this problem?

I thought of handling this by manipulating the cache, but this doesn't seem to be the optimal solution. Altough it would bewilder me if Hibernate wouldn't jave a solution to this Problem.

Thanks for your help,
ZeroOneInfinity


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.