Example usage for org.hibernate Session setHibernateFlushMode

List of usage examples for org.hibernate Session setHibernateFlushMode

Introduction

In this page you can find the example usage for org.hibernate Session setHibernateFlushMode.

Prototype

void setHibernateFlushMode(FlushMode flushMode);

Source Link

Document

Set the flush mode for this session.

Usage

From source file:com.booleanworks.kryptopterus.application.MainHibernateUtil.java

License:Apache License

public Session getNewSession(FlushMode flushMode, CacheMode cacheMode) {
    System.out.println("com.booleanworks.kryptopterus.application.MainHibernateUtil.getNewSession()");

    Session session;
    session = this.sessionFactory.openSession();
    session.setHibernateFlushMode(flushMode);
    session.setCacheMode(cacheMode);/*from   w w w.j a  v a2s  .co  m*/

    System.out.println("return session; => " + session.hashCode());
    return session;
}

From source file:org.jooby.internal.hbm.RootUnitOfWork.java

License:Apache License

public RootUnitOfWork(final Session session) {
    super(session);
    bind(session);
    session.setHibernateFlushMode(FlushMode.AUTO);
}

From source file:org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.java

License:Open Source License

/**
 * Returns the current hibernate session.
 * <p>//w ww  . j  ava2s .c o m
 * This ensures that the session flush mode is {@link FlushMode#COMMIT} to ensure that ids and versions get reverted
 * correctly if the transaction rolls back.
 *
 * @return the current hibernate session
 */
private Session getSession() {
    Session session = factory.getCurrentSession();
    session.setHibernateFlushMode(FlushMode.COMMIT);
    return session;
}