-->
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: Why delete/insert all rows of XREF table of many-to-many?
PostPosted: Mon Jan 10, 2005 4:03 pm 
Newbie

Joined: Mon Jan 10, 2005 3:49 pm
Posts: 1
Location: Newport Beach
Hibernate version: 2.1.7
Mapping documents:
<set
name="assocEntitlements"
table="rule_entitlement_xref"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted"
>
<key column="rule_id"></key>
<composite-element
class="com.bluedot.DBData.AssocEntitlement"
>
<many-to-one
name="entitlement"
class="com.bluedot.DBData.Entitlement"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="entitlement_id"
/>
<property
name="allocOption"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="alloc_option"
not-null="true"
/>
</composite-element>
</set>
Code between sessionFactory.openSession() and session.close():
tx = s.beginTransaction();
List rules = s.find("from Rule as rule where rule.name = ?", name.trim(), Hibernate.STRING);
Rule rule = (Rule)rules.get(0);
tx.commit();
Full stack trace of any exception that occurs:
No exceptions. Just wondering why and if the following can be stopped:
Hibernate deletes all rows of the rule_entitlement_xref table then re-inserting them:
Log file has the following:
DEBUG [net.sf.hibernate.impl.SessionImpl] Scheduling collection removes/(re)creates/updates
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.SQL] delete from rule_entitlement_xref where rule_id=? and entitlement_id=? and alloc_option=?
2005-01-09 19:35:50,480 INFO [STDOUT] Hibernate: delete from rule_entitlement_xref where rule_id=? and entitlement_id=? and alloc_option=?
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.type.LongType] binding '68' to parameter: 1
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.type.LongType] binding '44' to parameter: 2
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.type.StringType] binding 'Assign' to parameter: 3
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.impl.BatcherImpl] Adding to batch
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.type.LongType] binding '68' to parameter: 1
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.type.LongType] binding '34' to parameter: 2
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.type.StringType] binding 'Assign' to parameter: 3
2005-01-09 19:35:50,480 DEBUG [net.sf.hibernate.impl.BatcherImpl] Adding to batch
2005-01-09 19:35:50,496 DEBUG [net.sf.hibernate.collection.BasicCollectionPersister] done deleting collection rows: 2 deleted
2005-01-09 19:35:50,496 DEBUG [net.sf.hibernate.collection.BasicCollectionPersister] Updating rows of collection: com.bluedot.DBData.Rule.assocEntitlements#68
2005-01-09 19:35:50,496 DEBUG [net.sf.hibernate.collection.BasicCollectionPersister] done updating rows: 0 updated
2005-01-09 19:35:50,496 DEBUG [net.sf.hibernate.collection.BasicCollectionPersister] Inserting rows of collection: [com.bluedot.DBData.Rule.assocEntitlements#68]
2005-01-09 19:35:50,496 DEBUG [net.sf.hibernate.impl.BatcherImpl] Executing batch size: 2
2005-01-09 19:35:50,558 DEBUG [net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 0
2005-01-09 19:35:50,558 DEBUG [net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 1
2005-01-09 19:35:50,558 DEBUG [net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
2005-01-09 19:35:50,558 DEBUG [net.sf.hibernate.impl.BatcherImpl] closing statement
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.SQL] insert into rule_entitlement_xref (rule_id, entitlement_id, alloc_option) values (?, ?, ?)
2005-01-09 19:35:50,590 INFO [STDOUT] Hibernate: insert into rule_entitlement_xref (rule_id, entitlement_id, alloc_option) values (?, ?, ?)
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.type.LongType] binding '68' to parameter: 1
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.type.LongType] binding '44' to parameter: 2
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.type.StringType] binding 'Assign' to parameter: 3
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.impl.BatcherImpl] Adding to batch
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.impl.BatcherImpl] reusing prepared statement
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.SQL] insert into rule_entitlement_xref (rule_id, entitlement_id, alloc_option) values (?, ?, ?)
2005-01-09 19:35:50,590 INFO [STDOUT] Hibernate: insert into rule_entitlement_xref (rule_id, entitlement_id, alloc_option) values (?, ?, ?)
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.type.LongType] binding '68' to parameter: 1
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.type.LongType] binding '34' to parameter: 2
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.type.StringType] binding 'Assign' to parameter: 3
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.impl.BatcherImpl] Adding to batch
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.collection.BasicCollectionPersister] done inserting rows: 2 inserted
2005-01-09 19:35:50,590 DEBUG [net.sf.hibernate.impl.BatcherImpl] Executing batch size: 2
2005-01-09 19:35:50,637 DEBUG [net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 0
2005-01-09 19:35:50,637 DEBUG [net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 1
2005-01-09 19:35:50,652 DEBUG [net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
2005-01-09 19:35:50,652 DEBUG [net.sf.hibernate.impl.BatcherImpl] closing statement
2005-01-09 19:35:50,683 DEBUG [net.sf.hibernate.impl.SessionImpl] post flush

Name and version of the database you are using: Oracle 9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:


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.