-->
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 in deleting multiple rows of data
PostPosted: Mon May 24, 2004 10:40 pm 
Newbie

Joined: Mon May 17, 2004 6:19 am
Posts: 2
hello,
I am trying to delete multiple rows of data using the session.delete() method, but I'm getting an exception with the ff msg:


Hibernate: delete from tb_dept_accounts where deptId=?
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:122)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2385)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2340)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.j
ava:61)

there are several occurrences of deptId in the tb_dept_accounts table. The deptIds were deleted from the table but I also get this msg. When there was only one deptId, the delete transaction got no error message. Why is this so and what can I do to workaround this problem?


Im using Hibernate 2
mapping is
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="maintenance.model.DeptAccnt" table="tb_dept_accounts">
<id name="departmentCode" column="deptId" type="string" unsaved-value="none">
<generator class="assigned"/>
</id>
<property name="accntId" column="accntId"/>
</class>
</hibernate-mapping>

Im calling the delete method from Action class

public String deleteDeptAccnts(){
try{
deptAccntsDAO.deleteAccnts(getDeptAccnt());
// where getDeptAccnt is the object
}catch(Exception ex){
return ERROR;
}
return SUCCESS;
}

from the deptAccntsDAO class
public void deleteAccnts(DeptAccnt deptAccnt) throws Exception{
begin();
session.delete(deptAccnt);
commit();
}

thanks


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.