-->
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.  [ 4 posts ] 
Author Message
 Post subject: Unreferenced records in the database
PostPosted: Sun Sep 24, 2006 4:55 pm 
Newbie

Joined: Tue May 25, 2004 4:24 am
Posts: 13
In the past 2 weeks I’ve browsed your forums and googled through the web in attempt to find a lead for the problem we’re facing. I found several posts on this topic that suggested similar mappings to what is currently defined at our project. However, in most of the cases the business logic was different, which I guess explains, why only us are “stuck” with unreferenced records in the database.

So let me provide some additional info about the project environment and hopefully you could point on the root cause.

We’re using Hibernate 2.0, dialect: SybaseAnywhereDialect.

The database structure: Container 1--* Map of Commands *--* Command

Due to the business logic of the application, all the CRUD operations are made to the Container objects. So if a Command was deleted from the UI, the Command object is removed from the map and the Container object is updated (using session.update , which is also the only code between session.openSession() and session.close()). The map related DB table reflects the change, however in the command table, the deleted records still appear.

Here are the mappings:

Container:
Code:
<class name="x.y.z. Container" table="CONTAINER">

<id name="id" column="ID">
     <generator class="assigned" />
</id>

<property name="attr1" column="attr1" type="integer"/>
<property name="attr2" column=" attr2" type="integer"/>

<map name="CommandMap" table="COOMAND_MAP" cascade="all">
     <key column="REF_ID"/>
     <index column="ORDER" type=”int”/>
     <many-to-many column="COMMAND_ID"   class="x.y.z.Command"/>
</map>

</class>



[b]Command:

Code:

<class name="x,y,z.Command" table="COMMAND">
  <id name="id" column="ID">
      <generator class="assigned"/>
   </id>
<version column="version" name="version" type="integer" access="property" unsaved-value="undefined"/>
<property name="prop1" column=" prop1" type="boolean"/>
<property name=" prop2" column=" prop2" type="boolean"/>
</class>


Any help would be greatly appreciated.


Top
 Profile  
 
 Post subject: Any idea how can I debug it?
PostPosted: Thu Oct 19, 2006 9:29 am 
Newbie

Joined: Tue May 25, 2004 4:24 am
Posts: 13
Any idea how can I debug it?

We are going to release the product soon and we can't ship it with this bug.

Any help will be much appreciated !!!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 5:07 pm 
Beginner
Beginner

Joined: Tue Sep 26, 2006 11:46 pm
Posts: 33
cascade="all" wont automatically delete items that are removed from the collection. You need to use cascade="all-delete-orphan" if you want items to be automatically removed when you remove them from the collection.


Top
 Profile  
 
 Post subject: Tried that ...didn't work :(
PostPosted: Mon Nov 06, 2006 8:31 am 
Newbie

Joined: Tue May 25, 2004 4:24 am
Posts: 13
Thanks for the suggestion, I appreciate it!!

I tried it and it didn't work. Any other idea?


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