Forums Register Login

Problem with Hibernate database Session with flush() ?

+Pie Number of slices to send: Send
Hi,
I am facing problem while calling method

1) DB.flush();

2) public static void flush() {
LOG.debug(".... Flush ....");
HibernateUtil.getSession().flush();
}

3)

public static Session getSession()
throws InfrastructureException {
Session s = threadSession.get();
try {
if (s == null) {
LOG.debug("Opening new Session for this thread.");
if (getInterceptor() != null) {
LOG.info("Using interceptor: " + getInterceptor().getClass());
s = getSessionFactory().openSession(getInterceptor());
} else {
LOG.debug("No intereptor");
s = getSessionFactory().openSession();
LOG.debug("Got session");
}
threadSession.set(s);
LOG.debug("Put session in threadsession");
}
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}

// never auto flush
s.setFlushMode(FlushMode.MANUAL);

return s;
}

After wards i am getting error like :

org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
and

2009-08-07 10:58:19,005 ERROR http-8084-Processor25 event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

could you have any clue to resolve this issue.

Regards,
xyz
+Pie Number of slices to send: Send
Are you getting the exception in all three cases or .. ?

And I don't understand the below code ?


And please use code tags when posting code.
+Pie Number of slices to send: Send
No i am getting 1 exception , when the Db.flush() method finishes the call...and i have shown the three methods which using in call...

and theradSession is : instance of ThreadLocal..

private static final ThreadLocal<Session> threadSession = new ThreadLocal<Session>();
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2509 times.
Similar Threads
[Hibernate] NoClassDefFoundError
Caching Issues with Hibnernate
Through Hibernate,Struts2,Spring integration, While save records in MySQL table it's always updating
Help with JPA/Hibernate + MsSqlServer
hibernate session: to close or not to close
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:27:33.