本文整理了Java中org.hibernate.SessionFactory.unwrap()
方法的一些代码示例,展示了SessionFactory.unwrap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SessionFactory.unwrap()
方法的具体详情如下:
包路径:org.hibernate.SessionFactory
类名称:SessionFactory
方法名:unwrap
暂无
代码示例来源:origin: org.codehaus.griffon.plugins/griffon-hibernate5-core
@Override
public <T> T unwrap(Class<T> cls) {
return delegate.unwrap(cls);
}
代码示例来源:origin: net.krotscheck/kangaroo-common
/**
* Create a new pooled data source factory.
*
* @param sessionFactory The Hibernate Session Factory, Injected.
*/
@Inject
public PooledDataSourceFactory(final SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory.unwrap(SessionFactoryImpl.class);
}
代码示例来源:origin: hibernate/hibernate-search
@Test
public void shouldHandleTenantIds() throws Exception {
long executionId = jobOperator.start(
MassIndexingJob.NAME,
MassIndexingJob.parameters()
.forEntity( Company.class )
.tenantId( TARGET_TENANT_ID )
.build()
);
JobExecution jobExecution = jobOperator.getJobExecution( executionId );
JobTestUtil.waitForTermination( jobOperator, jobExecution, JOB_TIMEOUT_MS );
assertThat( jobExecution.getBatchStatus() ).isEqualTo( BatchStatus.COMPLETED );
EntityManagerFactory emf = getSessionFactory().unwrap( EntityManagerFactory.class );
assertThat( findIndexedResultsInTenant( emf, Company.class, "name", "Google", TARGET_TENANT_ID ) ).hasSize( 1 );
assertThat( findIndexedResultsInTenant( emf, Company.class, "name", "Red Hat", TARGET_TENANT_ID ) ).hasSize( 1 );
assertThat( findIndexedResultsInTenant( emf, Company.class, "name", "Microsoft", TARGET_TENANT_ID ) ).hasSize( 1 );
assertThat( findIndexedResultsInTenant( emf, Company.class, "name", "Google", UNUSED_TENANT_ID ) ).isEmpty();
assertThat( findIndexedResultsInTenant( emf, Company.class, "name", "Red Hat", UNUSED_TENANT_ID ) ).isEmpty();
assertThat( findIndexedResultsInTenant( emf, Company.class, "name", "Microsoft", UNUSED_TENANT_ID ) ).isEmpty();
}
内容来源于网络,如有侵权,请联系作者删除!