org.hibernate.CacheMode#GET源码实例Demo

下面列出了org.hibernate.CacheMode#GET 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: QueryBinder.java
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 );
	}
}
 
源代码2 项目: lams   文件: CacheModeHelper.java
/**
 * 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? :)" );
		}
	}
}
 
源代码3 项目: lams   文件: CacheModeHelper.java
/**
 * 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? :)" );
		}
	}
}
 
源代码4 项目: lams   文件: CacheModeHelper.java
public static CacheRetrieveMode interpretCacheRetrieveMode(CacheMode cacheMode) {
	if ( cacheMode == null ) {
		cacheMode = DEFAULT_LEGACY_MODE;
	}

	return ( CacheMode.NORMAL == cacheMode || CacheMode.GET == cacheMode )
			? CacheRetrieveMode.USE
			: CacheRetrieveMode.BYPASS;
}
 
源代码5 项目: cacheonix-core   文件: HbmBinder.java
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);
}
 
源代码6 项目: robe   文件: SystemParameterResource.java
/**
 * Return {@link SystemParameter) resource and matches with the given id.
 *
 * @param credentials Injected by {@link RobeAuth} annotation for authentication.
 * @param id          This is  the oid of {@link SystemParameter}
 * @return {@link SystemParameter} resource matches with the given id.
 */
@RobeService(group = "SystemParameter", description = "Return SystemParameter resource.")
@Path("{id}")
@GET
@UnitOfWork(readOnly = true, cacheMode = CacheMode.GET, flushMode = FlushMode.MANUAL)
public SystemParameter get(@RobeAuth Credentials credentials, @PathParam("id") String id) {

    SystemParameter entity = systemParameterDao.findById(id);
    if (entity == null) {
        throw new WebApplicationException(Response.status(404).build());
    }
    return entity;
}
 
源代码7 项目: robe   文件: UserResource.java
/**
 * Returns all {@link User}s as a collection.
 *
 * @param credentials injected by {@link RobeAuth} annotation for authentication.
 * @return all {@link User}s as a collection with.
 */

@RobeService(group = "User", description = "Returns all Users as a collection.")
@GET
@UnitOfWork(readOnly = true, cacheMode = CacheMode.GET, flushMode = FlushMode.MANUAL)
public List<User> getAll(@RobeAuth Credentials credentials, @SearchParam SearchModel search) {
    return userDao.findAllStrict(search);
}
 
源代码8 项目: robe   文件: UserResource.java
/**
 * Returns a single User matches with the given id.
 * <p>
 * Status Code:
 * Not Found  404
 *
 * @param credentials injected by {@link RobeAuth} annotation for authentication.
 * @param id          This is the oid of {@link User}
 * @return a {@link User} resource matches with the given id.
 */
@RobeService(group = "User", description = "Returns a User resource matches with the given id.")
@Path("{id}")
@GET
@UnitOfWork(readOnly = true, cacheMode = CacheMode.GET, flushMode = FlushMode.MANUAL)
public User get(@RobeAuth Credentials credentials, @PathParam("id") String id) {
    User entity = userDao.findById(id);
    if (entity == null) {
        throw new WebApplicationException(Response.status(404).build());
    }
    return entity;
}
 
源代码9 项目: hibernate-reactive   文件: ReactiveSessionImpl.java
@Override
public boolean isSecondLevelCacheCheckingEnabled() {
	return cacheMode == CacheMode.NORMAL || cacheMode == CacheMode.GET;
}
 
 方法所在类
 同类方法