This commit is contained in:
RedKale
2016-04-15 14:07:51 +08:00
parent f184376f95
commit 75e8767676
2 changed files with 6 additions and 7 deletions

View File

@@ -106,8 +106,7 @@ public final class EntityInfo<T> {
if (nodeid < 0) throw new IllegalArgumentException("nodeid(" + nodeid + ") is illegal");
rs = new EntityInfo(clazz, nodeid, cacheForbidden, conf);
entityInfos.put(clazz, rs);
AutoLoad auto = clazz.getAnnotation(AutoLoad.class);
if (rs.cache != null && auto != null && auto.value()) {
if (rs.cache != null) {
if (fullloader == null) throw new IllegalArgumentException(clazz.getName() + " auto loader is illegal");
rs.cache.fullLoad(fullloader.apply(clazz));
}
@@ -178,7 +177,8 @@ public final class EntityInfo<T> {
// }
DistributeGenerator dg = field.getAnnotation(DistributeGenerator.class);
if (dg != null) {
if (!field.getType().isPrimitive()) throw new RuntimeException(cltmp.getName() + "'s @" + DistributeGenerator.class.getSimpleName() + " primary must be primitive class type field");
if (!field.getType().isPrimitive())
throw new RuntimeException(cltmp.getName() + "'s @" + DistributeGenerator.class.getSimpleName() + " primary must be primitive class type field");
sqldistribute = true;
auto = false;
allocationSize0 = dg.allocationSize();

View File

@@ -5,15 +5,14 @@
*/
package org.redkale.util;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 自动加载。 使用场景:
* 1、被标记为@AutoLoad(false)的Service类不会被自动加载
* 2、被标记为@AutoLoad(false)的Servlet类不会被自动加载
* 3、被标记为@AutoLoad且同时被标记为@javax.persistence.Cacheable的Entity类在被DataSource初始化时需要将Entity类对应的表数据全量加载进缓存中。
*
* <p> 详情见: http://redkale.org
* @author zhangjx