Java 类org.hibernate.SessionException 实例源码

项目:lams    文件:AbstractLazyInitializer.java   
private void errorIfReadOnlySettingNotAvailable() {
    if ( session == null ) {
        throw new TransientObjectException(
                "Proxy is detached (i.e, session is null). The read-only/modifiable setting is only accessible when the proxy is associated with an open session."
        );
    }
    if ( session.isClosed() ) {
        throw new SessionException(
                "Session is closed. The read-only/modifiable setting is only accessible when the proxy is associated with an open session."
        );
    }
}
项目:lams    文件:SessionImpl.java   
@Override
public Connection close() throws HibernateException {
    LOG.trace( "Closing session" );
    if ( isClosed() ) {
        throw new SessionException( "Session was already closed" );
    }

    if ( factory.getStatistics().isStatisticsEnabled() ) {
        factory.getStatisticsImplementor().closeSession();
    }
    getEventListenerManager().end();

    try {
        if ( !isTransactionCoordinatorShared ) {
            return transactionCoordinator.close();
        }
        else {
            if ( getActionQueue().hasBeforeTransactionActions() || getActionQueue().hasAfterTransactionActions() ) {
                LOG.warn( "On close, shared Session had before / after transaction actions that have not yet been processed" );
            }
            else {
                transactionCoordinator.removeObserver( transactionObserver );
            }
            return null;
        }
    }
    finally {
        setClosed();
        cleanup();
    }
}
项目:lams    文件:StatelessSessionImpl.java   
@Override
public void managedClose() {
    if ( isClosed() ) {
        throw new SessionException( "Session was already closed!" );
    }
    transactionCoordinator.close();
    setClosed();
}
项目:AntiSocial-Platform    文件:ExceptionController.java   
@ExceptionHandler({
        SessionLimitExceededException.class,
        HttpSessionRequiredException.class,
        SessionException.class,
        SessionAuthenticationException.class,
        })
public String handleSessionRequired(Exception e, RedirectAttributes attr){
    attr.addFlashAttribute("error","Your session has been expired. Please log in again.");
    return "redirect:/error";
}
项目:AntiSocial-Platform    文件:ExceptionController.java   
@ExceptionHandler({

            HttpSessionRequiredException.class,
            SessionException.class,
            SessionAuthenticationException.class,
            })
    public String handleSessionRequired(Exception e, RedirectAttributes attr){
        e.printStackTrace();
        attr.addFlashAttribute("error","Your session has been expired. Please log in again.");
        return "redirect:/oups";
    }
项目:cacheonix-core    文件:JDBCContext.java   
public Connection connection() throws HibernateException {
    if ( owner.isClosed() ) {
        throw new SessionException( "Session is closed" );
    }

    return connectionManager.getConnection();
}
项目:cacheonix-core    文件:SessionImpl.java   
public Connection close() throws HibernateException {
    log.trace( "closing session" );
    if ( isClosed() ) {
        throw new SessionException( "Session was already closed" );
    }


    if ( factory.getStatistics().isStatisticsEnabled() ) {
        factory.getStatisticsImplementor().closeSession();
    }

    try {
        try {
            if ( childSessionsByEntityMode != null ) {
                Iterator childSessions = childSessionsByEntityMode.values().iterator();
                while ( childSessions.hasNext() ) {
                    final SessionImpl child = ( SessionImpl ) childSessions.next();
                    child.close();
                }
            }
        }
        catch( Throwable t ) {
            // just ignore
        }

        if ( rootSession == null ) {
            return jdbcContext.getConnectionManager().close();
        }
        else {
            return null;
        }
    }
    finally {
        setClosed();
        cleanup();
    }
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public void managedClose() {
    if ( isClosed() ) {
        throw new SessionException( "Session was already closed!" );
    }
    jdbcContext.getConnectionManager().close();
    setClosed();
}
项目:wildlife-camera-machine    文件:DAOTests.java   
public Session getSession()
{
    Session session;

    try {
        session = sessionFactory.getCurrentSession();
    } catch (SessionException se) {
        session = sessionFactory.openSession();
    }

    return session;
}
项目:lams    文件:AbstractSessionImpl.java   
protected void errorIfClosed() {
    if ( isClosed() ) {
        throw new SessionException( "Session is closed!" );
    }
}
项目:lams    文件:StatelessSessionImpl.java   
@Override
public Object immediateLoad(String entityName, Serializable id)
        throws HibernateException {
    throw new SessionException("proxies cannot be fetched by a stateless session");
}
项目:lams    文件:StatelessSessionImpl.java   
@Override
public void initializeCollection(
        PersistentCollection collection,
        boolean writing) throws HibernateException {
    throw new SessionException("collections cannot be fetched by a stateless session");
}
项目:cacheonix-core    文件:AbstractSessionImpl.java   
protected void errorIfClosed() {
    if ( closed ) {
        throw new SessionException( "Session is closed!" );
    }
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public Object immediateLoad(String entityName, Serializable id)
        throws HibernateException {
    throw new SessionException("proxies cannot be fetched by a stateless session");
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public void initializeCollection(
        PersistentCollection collection,
        boolean writing) throws HibernateException {
    throw new SessionException("collections cannot be fetched by a stateless session");
}