1   package org.gnomekr.potron.service;
2   
3   import static org.gnomekr.potron.util.PotronConstants.SPRING_CONTEXT_URI;
4   
5   import org.hibernate.Session;
6   import org.hibernate.SessionFactory;
7   import org.springframework.orm.hibernate3.SessionFactoryUtils;
8   import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
9   
10  /***
11   * AbstractHibernateSpringContextTests.java
12   * @author Xavier Cho
13   * @version $Revision 1.1 $ $Date: 2005/06/30 10:45:50 $
14   */
15  public abstract class AbstractHibernateSpringContextTests extends
16          AbstractTransactionalDataSourceSpringContextTests {
17  
18      /***
19       * @see org.springframework.test.AbstractDependencyInjectionSpringContextTests#getConfigLocations()
20       */
21      @Override
22      protected String[] getConfigLocations() {
23          return new String[] {
24              SPRING_CONTEXT_URI
25          };
26      }
27  
28      protected Session getCurrentSession() {
29          Session session = SessionFactoryUtils.getSession(
30                  (SessionFactory) applicationContext.getBean("sessionFactory"),
31                  false);
32          return session;
33      }
34  
35      protected void flushCurrentSession() {
36          getCurrentSession().flush();
37      }
38  }