Author: steve.ebersole(a)jboss.com
Date: 2010-09-16 12:53:09 -0400 (Thu, 16 Sep 2010)
New Revision: 20651
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/TestCase.java
Log:
HHH-5573 - Change TestCase to rebuildSessionFactory() whenever sessions var is accessed
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/TestCase.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/TestCase.java 2010-09-16
11:00:16 UTC (rev 20650)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/TestCase.java 2010-09-16
16:53:09 UTC (rev 20651)
@@ -55,18 +55,16 @@
}
public Session openSession() throws HibernateException {
- rebuildSessionFactory();
session = getSessions().openSession();
return session;
}
public Session openSession(Interceptor interceptor) throws HibernateException {
- rebuildSessionFactory();
session = getSessions().openSession( interceptor );
return session;
}
- private void rebuildSessionFactory() {
+ protected SessionFactory getSessions() {
if ( sessions == null ) {
try {
buildConfiguration();
@@ -75,13 +73,6 @@
throw new HibernateException( e );
}
}
- }
-
- protected void setSessions(SessionFactory sessions) {
- TestCase.sessions = sessions;
- }
-
- protected SessionFactory getSessions() {
return sessions;
}
@@ -91,8 +82,8 @@
@Override
protected void buildConfiguration() throws Exception {
- if ( getSessions() != null ) {
- getSessions().close();
+ if ( sessions != null ) {
+ sessions.close();
}
try {
setCfg( new AnnotationConfiguration() );
@@ -112,7 +103,7 @@
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(
xmlFile );
getCfg().addInputStream( is );
}
- setSessions( getCfg().buildSessionFactory( /* new TestInterceptor() */ ) );
+ sessions = getCfg().buildSessionFactory();
}
catch ( Exception e ) {
e.printStackTrace();
Show replies by date