Java Code Examples for org.hibernate.FlushMode#valueOf()

The following examples show how to use org.hibernate.FlushMode#valueOf() . 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: FlushModeTypeHelper.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public static FlushMode interpretExternalSetting(String externalName) {
	if ( externalName == null ) {
		return null;
	}

	try {
		log.debug( "Attempting to interpret external setting [" + externalName + "] as FlushMode name" );
		return FlushMode.valueOf( externalName.toUpperCase( Locale.ROOT) );
	}
	catch ( IllegalArgumentException e ) {
		log.debug( "Attempting to interpret external setting [" + externalName + "] as FlushModeType name" );
	}

	try {
		return getFlushMode( FlushModeType.valueOf( externalName.toLowerCase( Locale.ROOT ) ) );
	}
	catch ( IllegalArgumentException ignore ) {
	}

	throw new MappingException( "unknown FlushMode : " + externalName );
}
 
Example 2
Source File: ConfigurationHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static FlushMode getFlushMode(String flushMode)  {
	if (flushMode == null) {
		return null;
	}
	flushMode = flushMode.toUpperCase(Locale.ROOT);
	return FlushMode.valueOf( flushMode );
}
 
Example 3
Source File: GrailsOpenSessionInViewInterceptor.java    From gorm-hibernate5 with Apache License 2.0 5 votes vote down vote up
public void setHibernateDatastore(AbstractHibernateDatastore hibernateDatastore) {
    String defaultFlushModeName = hibernateDatastore.getDefaultFlushModeName();
    if(hibernateDatastore.isOsivReadOnly()) {
        this.hibernateFlushMode = FlushMode.MANUAL;
    }
    else {
        this.hibernateFlushMode = FlushMode.valueOf(defaultFlushModeName);
    }
    setSessionFactory(hibernateDatastore.getSessionFactory());
}
 
Example 4
Source File: GrailsHibernateQueryUtils.java    From gorm-hibernate5 with Apache License 2.0 5 votes vote down vote up
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;
    }
}