Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hibernate log error

3 views
Skip to first unread message

Jo

unread,
May 2, 2007, 10:19:32 AM5/2/07
to
Hi there:

Maybe some of you can enlighten me, after having an app runing 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.

Philipp Taprogge

unread,
May 2, 2007, 3:33:00 PM5/2/07
to
Hi!

Thus spake Jo on 05/02/2007 04:19 PM:


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

> any ideas?

Well, the error message is relatively clear: the database state is
inconsistent with the application state.
When hibernate tried to persist some changes to an object, the
database returned zero rows affected for that update. That propably
means, the particular row representing that object is gone.
It seems like some other code is accessing the database concurrently
and is updating or deleting data. That's definitively not a good
idea when using an O/R mapper...

HTH,

Phil

Jo

unread,
May 3, 2007, 4:21:37 AM5/3/07
to
hi thanks for your answer.
i m trying to make sense of this, because that particular part of the
code is something like this

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

and i get the error for the update


Philipp Taprogge

unread,
May 3, 2007, 2:24:45 PM5/3/07
to
Hi!

Thus spake Jo on 05/03/2007 10:21 AM:


> i m trying to make sense of this, because that particular part of the
> code is something like this
>
> try
> session.save(something);
> catch
> session.update(something);
> ...

Hmm... Two possibilities come to my mind:

Firstly, what exactly are you catching? Could it be that the
try-block throws something outside the save()-method? In a case like
this, the save() would actually have completed before the
catch-block was invoked.

Secondly, could it be that your database does not support
transactions or is set to a wrong transaction isolation level?
If you were using MySQL with myISAM tables (which do not support
transactions), part of the save() operation could actually be
completed before exception is thrown. Missing transaction support,
these updates would be persistent and would be seen by the update().

HTH,

Phil

Jo

unread,
May 8, 2007, 11:19:39 AM5/8/07
to
hi,

the first option no idea. however i added a line to write to the log
in the case there is an exception
second option, I m using MS SQL, and i m not sure what you mean by
transactions, can you please point me to somwhere i can read more
abotu this?
I googled java transaction MS SQL and i get some info regarding the
JDB driver for Ms sql 2005, no info on the 2k version
Cheers


j

On May 3, 7:24 pm, Philipp Taprogge <Philipp.Tapro...@gmx.net> wrote:
> Hi!
>

> Thus spakeJoon 05/03/2007 10:21 AM:

0 new messages