Java Code Examples for org.hibernate.CacheMode#PUT
The following examples show how to use
org.hibernate.CacheMode#PUT .
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 CacheMode getCacheMode(CacheModeType cacheModeType) { switch ( cacheModeType ) { case GET: return CacheMode.GET; case IGNORE: return CacheMode.IGNORE; case NORMAL: return CacheMode.NORMAL; case PUT: return CacheMode.PUT; case REFRESH: return CacheMode.REFRESH; default: throw new AssertionFailure( "Unknown cacheModeType: " + cacheModeType ); } }
Example 2
Source File: CacheModeHelper.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Given a JPA {@link CacheStoreMode} and {@link CacheRetrieveMode}, determine the corresponding * legacy Hibernate {@link CacheMode}. * * @param storeMode The JPA shared-cache store mode. * @param retrieveMode The JPA shared-cache retrieve mode. * * @return Corresponding {@link CacheMode}. */ public static CacheMode interpretCacheMode(CacheStoreMode storeMode, CacheRetrieveMode retrieveMode) { if ( storeMode == null ) { storeMode = DEFAULT_STORE_MODE; } if ( retrieveMode == null ) { retrieveMode = DEFAULT_RETRIEVE_MODE; } final boolean get = ( CacheRetrieveMode.USE == retrieveMode ); switch ( storeMode ) { case USE: { return get ? CacheMode.NORMAL : CacheMode.PUT; } case REFRESH: { // really (get == true) here is a bit of an invalid combo... return CacheMode.REFRESH; } case BYPASS: { return get ? CacheMode.GET : CacheMode.IGNORE; } default: { throw new IllegalStateException( "huh? :)" ); } } }
Example 3
Source File: CacheModeHelper.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Given a JPA {@link CacheStoreMode} and {@link CacheRetrieveMode}, determine the corresponding * legacy Hibernate {@link CacheMode}. * * @param storeMode The JPA shared-cache store mode. * @param retrieveMode The JPA shared-cache retrieve mode. * * @return Corresponding {@link CacheMode}. */ public static CacheMode effectiveCacheMode(CacheStoreMode storeMode, CacheRetrieveMode retrieveMode) { if ( storeMode == null && retrieveMode == null ) { return null; } if ( storeMode == null ) { storeMode = DEFAULT_STORE_MODE; } if ( retrieveMode == null ) { retrieveMode = DEFAULT_RETRIEVE_MODE; } final boolean get = ( CacheRetrieveMode.USE == retrieveMode ); switch ( storeMode ) { case USE: { return get ? CacheMode.NORMAL : CacheMode.PUT; } case REFRESH: { // really (get == true) here is a bit of an invalid combo... return CacheMode.REFRESH; } case BYPASS: { return get ? CacheMode.GET : CacheMode.IGNORE; } default: { throw new IllegalStateException( "huh? :)" ); } } }
Example 4
Source File: CacheModeHelper.java From lams with GNU General Public License v2.0 | 5 votes |
public static CacheStoreMode interpretCacheStoreMode(CacheMode cacheMode) { if ( cacheMode == null ) { cacheMode = DEFAULT_LEGACY_MODE; } if ( CacheMode.REFRESH == cacheMode ) { return CacheStoreMode.REFRESH; } if ( CacheMode.NORMAL == cacheMode || CacheMode.PUT == cacheMode ) { return CacheStoreMode.USE; } return CacheStoreMode.BYPASS; }
Example 5
Source File: HbmBinder.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public static CacheMode getCacheMode(String cacheMode) { if (cacheMode == null) return null; if ( "get".equals( cacheMode ) ) return CacheMode.GET; if ( "ignore".equals( cacheMode ) ) return CacheMode.IGNORE; if ( "normal".equals( cacheMode ) ) return CacheMode.NORMAL; if ( "put".equals( cacheMode ) ) return CacheMode.PUT; if ( "refresh".equals( cacheMode ) ) return CacheMode.REFRESH; throw new MappingException("Unknown Cache Mode: " + cacheMode); }