-->
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: Exception thrown when write 2 (or more) entites in successio
PostPosted: Mon Apr 18, 2005 11:42 am 
Newbie

Joined: Mon Apr 18, 2005 11:27 am
Posts: 3
Hi,
I have an application, where I an entity with composite-id from 2 columns. When I create new instance of this class and do sess.saveOrUpdate() it saves it, but if I create another instance and try to do the same with it in the same thread, it fails with exception thrown: HibernateException: Batch update row count wrong: 0

Hibernate version: v2.1

Mapping documents:
<class
name="sample.EntityDa"
table="ENTITY"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>

<composite-id
name="comp_id"
unsaved-value="none"
class="sample.EntityDaPK"
>
<key-property
name="prop1"
type="java.lang.String"
column="PROPERTY_1"
length="6"
/>

<key-property
name="prop2"
type="java.lang.String"
column="PROPERTY_2"
length="10"
/>

</composite-id>

<property
name="prop3"
type="java.lang.String"
update="false"
insert="false"
access="property"
column="PROPERTY_3"
length="6"
/>

Code between sessionFactory.openSession() and session.close():
tx = sess.beginTransaction();
sess.saveOrUpdate(toSave);
sess.flush();
tx.commit();
Full stack trace of any exception that occurs:

net.sf.hibernate.HibernateException: Batch update row count wrong: 0
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:65)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:128)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at sample.ApplicationDao.genericSaveOrUpdate(ApplicationDao.java:656)
at sample.ApplicationDao.saveUpdateEntityDa(ApplicationDao.java:40)
at sample.test.ApplicationTest.testChangeFlagDelete(ApplicationTest.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)

Name and version of the database you are using:
DB2 version 8.1
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 12:51 pm 
Senior
Senior

Joined: Mon Apr 04, 2005 8:04 am
Posts: 128
Location: Manchester, NH USA
Can you post the code where you are creating the new instance of the class? The code you posted is not complete. Thanks~


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.