Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Hibernate 3.1
Mapping documents:
Hibernate Mapping DTD 3.0
Code between sessionFactory.openSession() and session.close():
/**
* Retrieves the current Session local to the thread.
* <p/>
* If no Session is open, opens a new Session for the running thread.
*
* @return Session
*/
public static Session getSession(String ref) throws InfrastructureException {
Session s = (Session)threadSession.get();
try {
if (s == null) {
if (logger.isDebugEnabled())
logger.debug("Opening new Session for this thread. - " + ref);
if (getInterceptor() != null) {
if (logger.isDebugEnabled())
logger.debug("Using interceptor: " + getInterceptor().getClass());
s = getSessionFactory().openSession(getInterceptor());
} else {
s = getSessionFactory().openSession();
}
threadSession.set(s);
}
} catch (Exception ex) {
throw new InfrastructureException(ex);
}
return s;
}
/**
* Closes the Session local to the thread.
*/
public static void closeSession(long transactionId, String ref) throws InfrastructureException {
if (isStarterTransactionId(transactionId)) {
try {
Session s = (Session)threadSession.get();
threadSession.set(null);
if (s != null && s.isOpen()) {
if (logger.isDebugEnabled())
logger.debug("Closing Session of this thread. - " + ref);
s.close();
}
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
}
}
Full stack trace of any exception that occurs:
Name and version of the database you are using:
PostgreSQL 8.3
Problems with Session and transaction handling?
Yes
---------------#####------------
Hi,
Personnel is with a great problem in my application...
It is the following I am using the group Windows Server 2003 + Windows Terminal Service, PostgreSQL 8.3 and Hibernate 3.1 and it is happening that in intervals of 3 days on average,
some transactions don't happen, in other words,
I have a cadaster of patients and of attendances, the one where the patients are registered and if everything happens correctly (without any exception)
the program reads the registered patient and he/she allows to do the attendance for him, each operation with your transaction in separate,
happen that once in a while the patient that was to be registered it is not simply,
but in the program he/she didn't give any mistake or it didn't still fall in any exception, I placed messages in a log file, to identify after the commit,
that he really went by the that code line, and he passes, but from time to time him non sage, before I used Firebird,
now I changed for PostgreSQL thinking it was problem of the database, and anything, somebody knows me to say if I have q to alter some configuration of Hibernate, or still if
the possibility exists of some bug in the hibernate,
Respectfully, Anderson
Read this:
http://hibernate.org/42.html