本文整理了Java中org.hibernate.SessionFactory.openStatelessSession()
方法的一些代码示例,展示了SessionFactory.openStatelessSession()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SessionFactory.openStatelessSession()
方法的具体详情如下:
包路径:org.hibernate.SessionFactory
类名称:SessionFactory
方法名:openStatelessSession
[英]Open a new stateless session.
[中]打开一个新的无状态会话。
代码示例来源:origin: spring-projects/spring-batch
statelessSession = sessionFactory.openStatelessSession();
代码示例来源:origin: spring-projects/spring-batch
@Test
public void testOneSessionForAllPages() throws Exception {
StatelessSession session = mock(StatelessSession.class);
when(sessionFactory.openStatelessSession()).thenReturn(session);
helper.setSessionFactory(sessionFactory);
helper.createQuery();
// Multiple calls to createQuery only creates one session
helper.createQuery();
}
代码示例来源:origin: spring-projects/spring-batch
@Test
public void testSessionReset() throws Exception {
StatelessSession session = mock(StatelessSession.class);
when(sessionFactory.openStatelessSession()).thenReturn(session);
helper.setSessionFactory(sessionFactory);
helper.createQuery();
assertNotNull(ReflectionTestUtils.getField(helper, "statelessSession"));
helper.close();
assertNull(ReflectionTestUtils.getField(helper, "statelessSession"));
}
代码示例来源:origin: Impetus/Kundera
StatelessSession getStatelessSession()
{
if (sf != null)
{
return sf.openStatelessSession();
}
throw new PersistenceException("Session factory is not initialized");
}
}
代码示例来源:origin: hibernate/hibernate-orm
try {
SessionFactory sessionFactory = entityManagerFactory().unwrap( SessionFactory.class );
statelessSession = sessionFactory.openStatelessSession();
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue( jiraKey = "HHH-11732" )
public void test() {
Triggerable triggerable = logInspection.watchForLogMessages( "HHH000352" );
triggerable.reset();
StatelessSession session = entityManagerFactory().unwrap( SessionFactory.class ).openStatelessSession();
Transaction tx = session.beginTransaction();
try {
Employee employee = new Employee( "1", "2", 1 );
employee.setId( 1 );
session.insert( employee );
tx.rollback();
}
catch (HibernateException e) {
if ( tx != null ) {
tx.rollback();
}
}
finally {
session.close();
assertFalse( triggerable.wasTriggered() );
}
}
代码示例来源:origin: Impetus/Kundera
StatelessSession session = sf.openStatelessSession();
if (!pu.equals(getPersistenceUnit()))
代码示例来源:origin: org.codehaus.griffon.plugins/griffon-hibernate4-core
@Override
public StatelessSession openStatelessSession() {
return delegate.openStatelessSession();
}
代码示例来源:origin: org.codehaus.griffon.plugins/griffon-hibernate5-core
@Override
public StatelessSession openStatelessSession() {
return delegate.openStatelessSession();
}
代码示例来源:origin: picocontainer/picocontainer
/** {@inheritDoc} **/
public StatelessSession openStatelessSession(Connection connection) {
return delegate.openStatelessSession(connection);
}
代码示例来源:origin: picocontainer/picocontainer
/** {@inheritDoc} **/
public StatelessSession openStatelessSession(Connection connection) {
return delegate.openStatelessSession(connection);
}
代码示例来源:origin: picocontainer/picocontainer
/** {@inheritDoc} **/
public StatelessSession openStatelessSession() {
return delegate.openStatelessSession();
}
代码示例来源:origin: picocontainer/picocontainer
/** {@inheritDoc} **/
public StatelessSession openStatelessSession() {
return delegate.openStatelessSession();
}
代码示例来源:origin: com.atlassian.crowd/crowd-persistence-hibernate5
protected StatelessSession openSession() {
if (currentSessionHolder.get() != null) {
throw new IllegalStateException("session already open");
}
StatelessSession session = sessionFactory.openStatelessSession();
currentSessionHolder.set(session);
log.debug("open new session [{}]", currentSessionHolder.get());
return session;
}
}
代码示例来源:origin: com.impetus.kundera.client/kundera-rdbms
StatelessSession getStatelessSession()
{
if (sf != null)
{
return sf.openStatelessSession();
}
throw new PersistenceException("Session factory is not initialized");
}
}
代码示例来源:origin: v-ladynev/fluent-hibernate
/**
* Open a new stateless session.
*
* @return the created stateless session
*/
private static StatelessSession openStatelessSession() {
assertSessionFactory();
return sessionFactory.openStatelessSession();
}
代码示例来源:origin: com.carbonfive/db-support
public StatelessSession openStatelessSession()
{
return getSessionFactory().openStatelessSession();
}
代码示例来源:origin: com.impetus.client/kundera-rdbms
StatelessSession getStatelessSession()
{
if (sf != null)
{
return sf.openStatelessSession();
}
throw new PersistenceException("Session factory is not initialized");
}
}
代码示例来源:origin: denimgroup/threadfix
@Override
public void saveOrUpdateStateless(ChannelVulnerability channelVulnerability) {
StatelessSession statelessSession = sessionFactory.openStatelessSession();
statelessSession.insert(channelVulnerability);
statelessSession.close();
}
代码示例来源:origin: denimgroup/threadfix
@Override
public void insert(List<ChannelSeverity> channelSeverities) {
StatelessSession statelessSession = sessionFactory.openStatelessSession();
try {
for (ChannelSeverity channelSeverity : channelSeverities) {
statelessSession.insert(channelSeverity);
}
} finally {
statelessSession.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!