diff --git a/src/org/redkale/source/EntityInfo.java b/src/org/redkale/source/EntityInfo.java index 0bde74910..805a9ac7e 100644 --- a/src/org/redkale/source/EntityInfo.java +++ b/src/org/redkale/source/EntityInfo.java @@ -108,7 +108,7 @@ public final class EntityInfo { final BiFunction fullloader; //------------------------------------------------------------ - public static EntityInfo load(Class clazz, final int nodeid, final boolean cacheForbidden, final Properties conf, + static EntityInfo load(Class clazz, final int nodeid, final boolean cacheForbidden, final Properties conf, DataSource source, BiFunction fullloader) { EntityInfo rs = entityInfos.get(clazz); if (rs != null) return rs; @@ -127,7 +127,7 @@ public final class EntityInfo { } } - public static EntityInfo get(Class clazz) { + static EntityInfo get(Class clazz) { return entityInfos.get(clazz); } diff --git a/test/org/redkale/test/source/CacheTestBean.java b/test/org/redkale/test/source/CacheTestBean.java index ea0e71afe..142510d44 100644 --- a/test/org/redkale/test/source/CacheTestBean.java +++ b/test/org/redkale/test/source/CacheTestBean.java @@ -5,6 +5,7 @@ */ package org.redkale.test.source; +import java.lang.reflect.Method; import java.util.*; import java.util.function.BiFunction; import javax.persistence.Id; @@ -35,7 +36,11 @@ public class CacheTestBean { Attribute nameattr = Attribute.create(CacheTestBean.class, "name"); Attribute priceattr = Attribute.create(CacheTestBean.class, "price"); BiFunction fullloader = (s, z) -> list; - EntityCache cache = new EntityCache(EntityInfo.load(CacheTestBean.class, 0, true, new Properties(), null, fullloader)); + Method method = EntityInfo.class.getDeclaredMethod("load", Class.class, int.class, boolean.class, Properties.class, + DataSource.class, BiFunction.class); + method.setAccessible(true); + final EntityInfo info = (EntityInfo) method.invoke(null, CacheTestBean.class, 0, true, new Properties(), null, fullloader); + EntityCache cache = new EntityCache(info); cache.fullLoad(); System.out.println(cache.queryColumnMap("pkgid", FilterFunc.COUNT, "name", null)); diff --git a/test/org/redkale/test/source/TestSourceCache.java b/test/org/redkale/test/source/TestSourceCache.java index f01150ff8..3bfa9470d 100644 --- a/test/org/redkale/test/source/TestSourceCache.java +++ b/test/org/redkale/test/source/TestSourceCache.java @@ -5,6 +5,7 @@ */ package org.redkale.test.source; +import java.lang.reflect.Method; import java.util.*; import org.redkale.source.VirtualEntity; import org.redkale.source.FilterNodeBean; @@ -43,8 +44,10 @@ public class TestSourceCache { public static void main(String[] args) throws Exception { final BiFunction fullloader = (DataSource t, Class u) -> null; - - final EntityInfo info = EntityInfo.load(TestEntity.class, 0, false, new Properties(), null, fullloader); + Method method = EntityInfo.class.getDeclaredMethod("load", Class.class, int.class, boolean.class, Properties.class, + DataSource.class, BiFunction.class); + method.setAccessible(true); + final EntityInfo info = (EntityInfo) method.invoke(null, TestEntity.class, 0, false, new Properties(), null, fullloader); TestEntity[] entitys = new TestEntity[10_0000]; for (int i = 0; i < entitys.length; i++) { entitys[i] = new TestEntity(i + 1, "用户_" + (i + 1));