Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

hibernate log error

Thread view: 
Jo - 02 May 2007 15:19 GMT
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 - 02 May 2007 20:33 GMT
Hi!

> 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 - 03 May 2007 09:21 GMT
> Hi!
>
[quoted text clipped - 14 lines]
>
>         Phil
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 - 03 May 2007 19:24 GMT
Hi!

> i m trying to make sense of this, because that particular part of the
> code is something like this
[quoted text clipped - 4 lines]
>   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 - 08 May 2007 16:19 GMT
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

> Hi!
>
[quoted text clipped - 26 lines]
>
>         Phil


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.