-->
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.  [ 2 posts ] 
Author Message
 Post subject: 2.1 & Caching & Cascades
PostPosted: Mon Oct 13, 2003 6:26 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
Hi,

I have two classes: A has a set of Bs, B can have one or none As:

in the A mapping:
Code:
<set
         name="bees"
         lazy="true"
         inverse="false"
         cascade="none"
         sort="natural"
         >

         <key
            column="a_id"
            >
         </key>

         <one-to-many
            class="my.B"
            />

      </set>


in the B mapping:
Code:
<many-to-one
         name="a"
         class="my.A"
         column="a_id"
         not-null="false"
         unique="false"
         cascade="none"
         outer-join="auto"
         />


I want deleting an instance of A to set B's FK (and java pointer) to null. This was working well before I added the cache but since I added caching I get a
"net.sf.hibernate.ObjectNotFoundException: No row with the given identifier exists" or a JDBC error about a foreign key not satisfied.

I suspect that I have to make A implement LifeCycle and actually iterate through each of A's Bs, setting its reference to A to null. But I hope not.

Any suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2003 4:50 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
ok ok, so this has to do with "Hibernate has no garbage collection" ... sheesh "you have to delete all references to entities you are deleting from the database" , life was easier without the process-level cache


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.