org.hibernate.engine.spi.SessionFactoryImplementor.close()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.hibernate.engine.spi.SessionFactoryImplementor.close()方法的一些代码示例,展示了SessionFactoryImplementor.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SessionFactoryImplementor.close()方法的具体详情如下:
包路径:org.hibernate.engine.spi.SessionFactoryImplementor
类名称:SessionFactoryImplementor
方法名:close

SessionFactoryImplementor.close介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void close() throws HibernateException {
  delegate.close();
}

代码示例来源:origin: hibernate/hibernate-orm

protected void rebuildSessionFactory(Consumer<Configuration> configurationAdapter) {
  if ( sessionFactory == null ) {
    return;
  }
  try {
    sessionFactory.close();
    sessionFactory = null;
    configuration = null;
    serviceRegistry.destroy();
    serviceRegistry = null;
  }
  catch (Exception ignore) {
  }
  buildSessionFactory( configurationAdapter );
}

代码示例来源:origin: hibernate/hibernate-orm

@After
public void releaseSessionFactory() {
  if ( sessionFactory != null ) {
    sessionFactory.close();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@After
public void releaseResources() {
  if ( sessionFactory != null ) {
    sessionFactory.close();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@AfterClass
public static void closeSessionFactory() {
  if ( SESSION_FACTORY != null ) {
    SESSION_FACTORY.close();
    SESSION_FACTORY = null;
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testAccessOnAssociationXmlElement() throws Exception {
  Class<?> classUnderTest = RentalCar.class;
  List<Class<?>> classes = new ArrayList<Class<?>>();
  classes.add( classUnderTest );
  classes.add( Driver.class );
  List<String> configFiles = new ArrayList<String>();
  configFiles.add( "org/hibernate/test/annotations/access/xml/RentalCar.xml" );
  SessionFactoryImplementor factory = buildSessionFactory( classes, configFiles );
  assertAccessType( factory, classUnderTest, AccessType.PROPERTY );
  factory.close();
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testAccessOnEmbeddedXmlElement() throws Exception {
  Class<?> classUnderTest = Cook.class;
  List<Class<?>> classes = new ArrayList<Class<?>>();
  classes.add( classUnderTest );
  classes.add( Knive.class );
  List<String> configFiles = new ArrayList<String>();
  configFiles.add( "org/hibernate/test/annotations/access/xml/Cook.xml" );
  SessionFactoryImplementor factory = buildSessionFactory( classes, configFiles );
  assertAccessType( factory, classUnderTest, AccessType.PROPERTY );
  factory.close();
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testAccessOnElementCollectionXmlElement() throws Exception {
  Class<?> classUnderTest = Boy.class;
  List<Class<?>> classes = new ArrayList<Class<?>>();
  classes.add( classUnderTest );
  List<String> configFiles = new ArrayList<String>();
  configFiles.add( "org/hibernate/test/annotations/access/xml/Boy.xml" );
  SessionFactoryImplementor factory = buildSessionFactory( classes, configFiles );
  assertAccessType( factory, classUnderTest, AccessType.PROPERTY );
  factory.close();
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testAccessOnMappedSuperClassXmlElement() throws Exception {
  Class<?> classUnderTest = Waiter.class;
  List<Class<?>> classes = new ArrayList<Class<?>>();
  classes.add( classUnderTest );
  classes.add( Crew.class );
  List<String> configFiles = new ArrayList<String>();
  configFiles.add( "org/hibernate/test/annotations/access/xml/Crew.xml" );
  SessionFactoryImplementor factory = buildSessionFactory( classes, configFiles );
  assertAccessType( factory, classUnderTest, AccessType.FIELD );
  factory.close();
}

代码示例来源:origin: hibernate/hibernate-orm

@After
public void destroy() {
  sessionFactory.close();
  connectionProvider.stop();
}

代码示例来源:origin: hibernate/hibernate-orm

@AfterClassOnce
public void releaseEntityManagerFactory() {
  if ( entityManagerFactory != null && entityManagerFactory.isOpen() ) {
    entityManagerFactory.close();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@After
@SuppressWarnings("unused")
public void releaseResources() {
  if ( sessionFactory != null ) {
    sessionFactory.close();
  }
  if ( serviceRegistry != null ) {
    StandardServiceRegistryBuilder.destroy( serviceRegistry );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@After
public void tearDown() throws Exception {
  if ( sessionFactory != null ) {
    sessionFactory.close();
  }
  if ( serviceRegistry != null ) {
    StandardServiceRegistryBuilder.destroy( serviceRegistry );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testAccessOnBasicXmlElement() throws Exception {
  Class<?> classUnderTest = Tourist.class;
  List<Class<?>> classes = new ArrayList<Class<?>>();
  classes.add( classUnderTest );
  List<String> configFiles = Collections.emptyList();
  SessionFactoryImplementor factory = buildSessionFactory( classes, configFiles );
  // without any xml configuration we have field access
  assertAccessType( factory, classUnderTest, AccessType.FIELD );
  factory.close();
  // now with an additional xml configuration file changing the default access type for Tourist using basic
  configFiles = new ArrayList<String>();
  configFiles.add( "org/hibernate/test/annotations/access/xml/Tourist.xml" );
  factory = buildSessionFactory( classes, configFiles );
  assertAccessType( factory, classUnderTest, AccessType.PROPERTY );
  factory.close();
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testAccessOnEntityMappingsXmlElement() throws Exception {
  Class<?> classUnderTest = Tourist.class;
  List<Class<?>> classes = new ArrayList<Class<?>>();
  classes.add( classUnderTest );
  List<String> configFiles = Collections.emptyList();
  SessionFactoryImplementor factory = buildSessionFactory( classes, configFiles );
  // without any xml configuration we have field access
  assertAccessType( factory, classUnderTest, AccessType.FIELD );
  factory.close();
  // now with an additional xml configuration file changing the default access type for Tourist using default in entity-mappings
  configFiles = new ArrayList<String>();
  configFiles.add( "org/hibernate/test/annotations/access/xml/Tourist3.xml" );
  factory = buildSessionFactory( classes, configFiles );
  assertAccessType( factory, classUnderTest, AccessType.PROPERTY );
  factory.close();
}

代码示例来源:origin: hibernate/hibernate-orm

@After
public void tearDown() throws Exception {
  if ( sessionImpl != null && !sessionImpl.isClosed() ) {
    ((Session) sessionImpl).close();
  }
  if ( sessionFactory != null ) {
    sessionFactory.close();
  }
  if ( serviceRegistry != null ) {
    StandardServiceRegistryBuilder.destroy( serviceRegistry );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * Sort of the inverse test of {@link MissingCacheStrategyTest#testMissingCacheStrategyFail()}.
 * Here building the SF should succeed.
 */
@Test
public void testPreDefinedCachesAllowed() {
  TestHelper.preBuildAllCaches();
  SessionFactoryImplementor sessionFactory = TestHelper.buildStandardSessionFactory();
  sessionFactory.close();
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void test() {
  sessionFactory().close();
  buildSessionFactory();
}

代码示例来源:origin: hibernate/hibernate-orm

@After
public void cleanupData() {
  if ( sessionFactory == null ) {
    return;
  }
  inTransaction(
      sessionFactory,
      s -> {
        s.createQuery( "delete from Person" ).executeUpdate();
      }
  );
  sessionFactory.close();
}

代码示例来源:origin: hibernate/hibernate-orm

@After
public void tearDown() {
  if ( sessionFactory != null ) {
    sessionFactory.close();
  }
  if ( serviceRegistry != null ) {
    serviceRegistry.destroy();
  }
  if ( jbossProvider != null ) {
    jbossProvider.stop();
  }
  if ( acmeProvider != null ) {
    acmeProvider.stop();
  }
}

相关文章

微信公众号

最新文章

更多

SessionFactoryImplementor类方法