本文整理了Java中org.hibernate.engine.spi.SessionFactoryImplementor.openStatelessSession()
方法的一些代码示例,展示了SessionFactoryImplementor.openStatelessSession()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SessionFactoryImplementor.openStatelessSession()
方法的具体详情如下:
包路径:org.hibernate.engine.spi.SessionFactoryImplementor
类名称:SessionFactoryImplementor
方法名:openStatelessSession
暂无
代码示例来源:origin: hibernate/hibernate-orm
@Override
public StatelessSession openStatelessSession() {
return delegate.openStatelessSession();
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public StatelessSession openStatelessSession(Connection connection) {
return delegate.openStatelessSession( connection );
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue(jiraKey = "HHH-12141")
public void testInsertInStatelessSession() throws Exception {
doInHibernate( this::sessionFactory, session -> {
session.doWork( connection -> {
StatelessSession sls = sessionFactory().openStatelessSession( connection );
NativeQuery q = sls.createNativeQuery(
"INSERT INTO TEST_ENTITY (ID,SIMPLE_ATTRIBUTE) values (1,'red')" );
q.executeUpdate();
} );
} );
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testInsertWithForeignKey() {
Session session = sessionFactory().openSession();
Transaction tx = session.beginTransaction();
Message msg = new Message();
final String messageId = "message_id";
msg.setId(messageId);
msg.setContent("message_content");
msg.setSubject("message_subject");
session.save(msg);
tx.commit();
session.close();
StatelessSession statelessSession = sessionFactory().openStatelessSession();
tx = statelessSession.beginTransaction();
MessageRecipient signature = new MessageRecipient();
signature.setId("recipient");
signature.setEmail("recipient@hibernate.org");
signature.setMessage(msg);
statelessSession.insert(signature);
tx.commit();
cleanup();
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testDynamicFetch() {
Session s = openSession();
s.beginTransaction();
Date now = new Date();
User me = new User( "me" );
User you = new User( "you" );
Resource yourClock = new Resource( "clock", you );
Task task = new Task( me, "clean", yourClock, now ); // :)
s.save( me );
s.save( you );
s.save( yourClock );
s.save( task );
s.getTransaction().commit();
s.close();
StatelessSession ss = sessionFactory().openStatelessSession();
ss.beginTransaction();
Task taskRef = ( Task ) ss.createQuery( "from Task t join fetch t.resource join fetch t.user" ).uniqueResult();
assertTrue( taskRef != null );
assertTrue( Hibernate.isInitialized( taskRef ) );
assertTrue( Hibernate.isInitialized( taskRef.getUser() ) );
assertTrue( Hibernate.isInitialized( taskRef.getResource() ) );
assertFalse( Hibernate.isInitialized( taskRef.getResource().getOwner() ) );
ss.getTransaction().commit();
ss.close();
cleanup();
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
@Override
public StatelessSession openStatelessSession(Connection connection) {
return delegate.openStatelessSession( connection );
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
@Override
public StatelessSession openStatelessSession() {
return delegate.openStatelessSession();
}
代码示例来源:origin: babyfish-ct/babyfish
public static void install(SessionFactoryImplementor sfi) {
if (!SettingsFactory.isDistinctRankCreateable(sfi.getProperties())) {
return;
}
LOGGER.info(
tryToCreateAnalyticFunction(
SettingsFactory.CREATE_ORACLE_DISTINCT_RANK,
"true",
DISTINCT_RANK
)
);
StatelessSession sls = sfi.openStatelessSession();
try {
Connection con = ((SessionImplementor)sls).connection();
installPLSQLWrapper(con);
} catch (SQLException ex) {
throw new QueryException(ex);
} catch (IOException ex) {
throw new HibernateException("Can not install the installable dialect", ex);
} finally {
sls.close();
}
}
代码示例来源:origin: stackoverflow.com
StatelessSession session = sessionFactoryImpl.openStatelessSession();
session.beginTransaction();
内容来源于网络,如有侵权,请联系作者删除!