-->
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.  [ 6 posts ] 
Author Message
 Post subject: Unexpected row count: 0 expected: 1
PostPosted: Wed May 02, 2007 10:26 am 
Newbie

Joined: Wed May 02, 2007 10:25 am
Posts: 3
Hi there:

Maybe some of you can enlighten me, after having an app running for a
long time I ve got this errors in my log.

2007-05-01 21:55:01,523 3123042484 ERROR
[DefaultQuartzScheduler_Worker-9]
org.hibernate.event.def.AbstractFlushingEventListener - 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.update(BasicEntityPersister.java:
1982)
at
org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:
1909)
at
org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:
2149)
at
org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:
75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
137)
at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:
274)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:
27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:
86)
...

please do keep in mind that this section of the application runs very
often so I can only think in a data related issue, but I cant find
anything useful after a good google round.
any ideas?

Jo.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 10:54 am 
Newbie

Joined: Mon Apr 17, 2006 6:18 pm
Posts: 12
This can happen if you try to update/delete a not existing row.

You could try saveOrUpdate


Last edited by MichaelBulla on Wed May 02, 2007 10:56 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: PrimaryKey not unique?
PostPosted: Wed May 02, 2007 10:56 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
edit: duh, I misread (expect 1, found 0) previous comment removed

_________________
Edwin van der Elst
Finalist IT Group


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 12:53 pm 
Newbie

Joined: Wed May 02, 2007 10:25 am
Posts: 3
??


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 1:10 pm 
Newbie

Joined: Mon Apr 17, 2006 6:18 pm
Posts: 12
I suppose in your Source there is something like

session.update(anyData);

But if the row associated to anyData doesnt exist (maybe because it wasnt inserted or because you deleted ist), you get this exception.

If anyData was deleted by any other thread or application, you have a problem, otherwise you can use

session.saveOrUpdate(anyData)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 3:46 am 
Newbie

Joined: Wed May 02, 2007 10:25 am
Posts: 3
hi there:

actually the code is more like this

try
session.save(something);
catch
session.update(anyData);
....
....


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