sessionFactory本来就是hibernate的,spring的localsessionFactory不过是org.hibernate.SessionFactory接口的一个实现罢了.当然hibernate中也有很多该接口的实现,如org.hibernate.impl.SessionFactoryImpl等,都是可以产生session的.public interface SessionFactory extends Referenceable, Serializable { /**
* Open a <tt>Session</tt> on the given connection.
* <p>
* Note that the second-level cache will be disabled if you
* supply a JDBC connection. Hibernate will not be able to track
* any statements you might have executed in the same transaction.
* Consider implementing your own <tt>ConnectionProvider</tt>.
*
* @param connection a connection provided by the application.
* @return Session
*/
public org.hibernate.classic.Session openSession(Connection connection); /**
* Create database connection and open a <tt>Session</tt> on it, specifying an
* interceptor.
*
* @param interceptor a session-scoped interceptor
* @return Session
* @throws HibernateException
*/
public org.hibernate.classic.Session openSession(Interceptor interceptor) throws HibernateException; /**
* Open a <tt>Session</tt> on the given connection, specifying an interceptor.
* <p>
* Note that the second-level cache will be disabled if you
* supply a JDBC connection. Hibernate will not be able to track
* any statements you might have executed in the same transaction.
* Consider implementing your own <tt>ConnectionProvider</tt>.
*
* @param connection a connection provided by the application.
* @param interceptor a session-scoped interceptor
* @return Session
*/
public org.hibernate.classic.Session openSession(Connection connection, Interceptor interceptor);
.
.
.
.
.
.
}
* Open a <tt>Session</tt> on the given connection.
* <p>
* Note that the second-level cache will be disabled if you
* supply a JDBC connection. Hibernate will not be able to track
* any statements you might have executed in the same transaction.
* Consider implementing your own <tt>ConnectionProvider</tt>.
*
* @param connection a connection provided by the application.
* @return Session
*/
public org.hibernate.classic.Session openSession(Connection connection); /**
* Create database connection and open a <tt>Session</tt> on it, specifying an
* interceptor.
*
* @param interceptor a session-scoped interceptor
* @return Session
* @throws HibernateException
*/
public org.hibernate.classic.Session openSession(Interceptor interceptor) throws HibernateException; /**
* Open a <tt>Session</tt> on the given connection, specifying an interceptor.
* <p>
* Note that the second-level cache will be disabled if you
* supply a JDBC connection. Hibernate will not be able to track
* any statements you might have executed in the same transaction.
* Consider implementing your own <tt>ConnectionProvider</tt>.
*
* @param connection a connection provided by the application.
* @param interceptor a session-scoped interceptor
* @return Session
*/
public org.hibernate.classic.Session openSession(Connection connection, Interceptor interceptor);
.
.
.
.
.
.
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货