**My hibernate version was outdated it was 3.1 and I migrated to 3.6 which works perfect and I was trying to migrate to 4.3.11 from 3.6.However i am having trouble in my HibernateUtils, with couple of "java.lang.Error: Unresolved compilation problems"**Here is a piece from my HibernateUtil
Session s = (Session) threadSession.get();
try {
if (null == s || !s.isOpen() || !s.isConnected()) {
if (null != getInterceptor()) {
WLog.DAOLogger.debug("Using interceptor: " + getInterceptor().getClass());
s = getSessionFactory().openSession(getInterceptor());
} // end if
else {
s = getSessionFactory().openSession();
if (testConnections) {
Connection c = s.connection();
Here is my stacktrace
java.lang.Error: Unresolved compilation problems: The method openSession() in the type SessionFactory is not applicable for the arguments (Interceptor) The method connection() is undefined for the type Session
I am using hibernate 4.3.11.Final and connection is not deprecated in my HIbernateUtil
Here is a small piece of code from HibernateUtils which using connection
public static void executeDDL( String ddl ) {
Session session = HibernateUtils.getSessionFactory().openSession();
Connection conn = session.connection();
try {
Statement stmt = conn.createStatement();
stmt.executeUpdate( ddl );
stmt.close();
} catch( SQLException e ) {
throw new HibernateException( "Can't execute DDL'" + ddl + "'.", e );
} finally {
Settings settings = HibernateUtils.getConfiguration().buildSettings();
if( settings.getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT ) {
try {
conn.close();
} catch( SQLException e ) {
WLog.ProjectLogger.error( "Can't close SQL connection", e );
}
}
session.close();
}
}