Java Code Examples for org.hibernate.FlushMode#COMMIT
The following examples show how to use
org.hibernate.FlushMode#COMMIT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryBinder.java From lams with GNU General Public License v2.0 | 6 votes |
private static FlushMode getFlushMode(FlushModeType flushModeType) { FlushMode flushMode; switch ( flushModeType ) { case ALWAYS: flushMode = FlushMode.ALWAYS; break; case AUTO: flushMode = FlushMode.AUTO; break; case COMMIT: flushMode = FlushMode.COMMIT; break; case NEVER: flushMode = FlushMode.MANUAL; break; case MANUAL: flushMode = FlushMode.MANUAL; break; case PERSISTENCE_CONTEXT: flushMode = null; break; default: throw new AssertionFailure( "Unknown flushModeType: " + flushModeType ); } return flushMode; }
Example 2
Source File: FlushModeTypeHelper.java From lams with GNU General Public License v2.0 | 6 votes |
public static FlushModeType getFlushModeType(FlushMode flushMode) { if ( flushMode == FlushMode.ALWAYS ) { log.debug( "Interpreting Hibernate FlushMode#ALWAYS to JPA FlushModeType#AUTO; may cause problems if relying on FlushMode#ALWAYS-specific behavior" ); return FlushModeType.AUTO; } else if ( flushMode == FlushMode.MANUAL ) { log.debug( "Interpreting Hibernate FlushMode#MANUAL to JPA FlushModeType#COMMIT; may cause problems if relying on FlushMode#MANUAL-specific behavior" ); return FlushModeType.COMMIT; } else if ( flushMode == FlushMode.COMMIT ) { return FlushModeType.COMMIT; } else if ( flushMode == FlushMode.AUTO ) { return FlushModeType.AUTO; } throw new AssertionFailure( "unhandled FlushMode " + flushMode ); }
Example 3
Source File: GrailsOpenSessionInViewInterceptor.java From gorm-hibernate5 with Apache License 2.0 | 6 votes |
@Override public void postHandle(WebRequest request, ModelMap model) throws DataAccessException { SessionHolder sessionHolder = (SessionHolder)TransactionSynchronizationManager.getResource(getSessionFactory()); Session session = sessionHolder != null ? sessionHolder.getSession() : null; try { super.postHandle(request, model); FlushMode flushMode = session != null ? session.getHibernateFlushMode() : null; boolean isNotManual = flushMode != FlushMode.MANUAL && flushMode != FlushMode.COMMIT; if (session != null && isNotManual) { if(logger.isDebugEnabled()) { logger.debug("Eagerly flushing Hibernate session"); } session.flush(); } } finally { if (session != null) { session.setHibernateFlushMode(FlushMode.MANUAL); } } }
Example 4
Source File: HbmBinder.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
public static final FlushMode getFlushMode(String flushMode) { if ( flushMode == null ) { return null; } else if ( "auto".equals( flushMode ) ) { return FlushMode.AUTO; } else if ( "commit".equals( flushMode ) ) { return FlushMode.COMMIT; } else if ( "never".equals( flushMode ) ) { return FlushMode.NEVER; } else if ( "manual".equals( flushMode ) ) { return FlushMode.MANUAL; } else if ( "always".equals( flushMode ) ) { return FlushMode.ALWAYS; } else { throw new MappingException( "unknown flushmode" ); } }
Example 5
Source File: MutinySessionImpl.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 5 votes |
@Override public FlushMode getFlushMode() { switch ( delegate.getHibernateFlushMode() ) { case MANUAL: return FlushMode.MANUAL; case COMMIT: return FlushMode.COMMIT; case AUTO: return FlushMode.AUTO; case ALWAYS: return FlushMode.ALWAYS; default: throw new IllegalStateException("impossible flush mode"); } }
Example 6
Source File: StageSessionImpl.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 5 votes |
@Override public FlushMode getFlushMode() { switch ( delegate.getHibernateFlushMode() ) { case MANUAL: return FlushMode.MANUAL; case COMMIT: return FlushMode.COMMIT; case AUTO: return FlushMode.AUTO; case ALWAYS: return FlushMode.ALWAYS; default: throw new IllegalStateException("impossible flush mode"); } }
Example 7
Source File: ConfigurationHelper.java From lams with GNU General Public License v2.0 | 5 votes |
private static FlushMode getFlushMode(FlushModeType flushMode) { switch(flushMode) { case AUTO: return FlushMode.AUTO; case COMMIT: return FlushMode.COMMIT; default: throw new AssertionFailure("Unknown FlushModeType: " + flushMode); } }
Example 8
Source File: FlushModeTypeHelper.java From lams with GNU General Public License v2.0 | 5 votes |
public static FlushMode getFlushMode(FlushModeType flushModeType) { if ( flushModeType == FlushModeType.AUTO ) { return FlushMode.AUTO; } else if ( flushModeType == FlushModeType.COMMIT ) { return FlushMode.COMMIT; } throw new AssertionFailure( "unhandled FlushModeType " + flushModeType ); }
Example 9
Source File: GrailsHibernateQueryUtils.java From gorm-hibernate5 with Apache License 2.0 | 5 votes |
private static FlushMode convertFlushMode(Object object) { if (object == null) { return null; } if (object instanceof FlushMode) { return (FlushMode) object; } try { return FlushMode.valueOf(object.toString()); } catch (IllegalArgumentException e) { return FlushMode.COMMIT; } }
Example 10
Source File: StatelessSessionImpl.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public FlushMode getFlushMode() { return FlushMode.COMMIT; }