-->
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: Delete being performed twice
PostPosted: Mon Oct 10, 2005 5:20 am 
Newbie

Joined: Mon Oct 10, 2005 4:49 am
Posts: 5
Hello,

I'm having a random problem while deleting an object. Once in a while, it seems that the delete is being executed twice by hibernate, the second one resulting in an exception (cf. trace).

Have you ever seen such a behaviour ?
Thank's for your help

Jim


Hibernate version:3.0.3


/*** /
Ctlg catalog = DAOFactory.getCatalogDAO().getCtlg(cd, rav, secondLoc);
if (catalog != null) {
...
}
DAOFactory.getCatalogDAO().delete(catalog);



/*** /
public void delete(Ctlg catalog) {
Transaction tx = getSession().beginTransaction();
try {
getSession().delete(catalog);
tx.commit();
} catch (Throwable e) {
tx.rollback();
throw new DAOException( "Error deleting the catalog : " + catalog.toString(), e);
}
}



[2005-10-07 13:41:58.036] delete from CTLG where CD='XX' and RAV=' YYY' and SECOND_LOC='T1 '
[2005-10-07 13:41:58.036] delete from CTLG where CD='XX' and RAV=' YYY' and SECOND_LOC='T1 '
[2005-10-07 13:41:58.048] org.hibernate.event.def.AbstractFlushingEventListener addToBatch Could not synchronize database state with session org.hibernate.HibernateException: Unexpected row count: 0 expected: 1
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:32)
at org.hibernate.persister.entity.BasicEntityPersister.delete(BasicEntityPersister.java:2059)
at org.hibernate.persister.entity.BasicEntityPersister.delete(BasicEntityPersister.java:2203)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 5:29 am 
Newbie

Joined: Mon Oct 10, 2005 4:49 am
Posts: 5
It is weird but it seems to happen only with IE. With Mozilla, it seems that it never happens ???


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 6:12 am 
Newbie

Joined: Mon Oct 10, 2005 4:49 am
Posts: 5
I have more informations :
When it happens, there are 2 same requests being sent to websphere.

My session is being opened by the first query and all my sessions are closed at the end of that request's treatment.

So, it seems that the second delete is performed in another session, and that when it tries to find if it exists
Quote:
Ctlg catalog = DAOFactory.getCatalogDAO().getCtlg(cd, rav, secondLoc);
if (catalog == null) {
...
}


So in that case i'm having in 2 different sessions the same object. And hibernate tries to delete it in the 2 sessions nearly at the same moment.

Should i use the get method to avoid that or what else can be done ?
Thank's

Jim


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 8:43 am 
Newbie

Joined: Mon Oct 10, 2005 4:49 am
Posts: 5
Hum, it seems my fellow, that created the frontend, created that bug.

I'm going to check that, but it seems he submits his form twice. And firefox is managing this whereas ie is not.

Jim


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.