mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
FIX: correct caching when collection with different inherited beans is put to the cache (#1379)
* FIX: correct cahcing when collection with different inherited beans is put to the cache * removed some sysouts
This commit is contained in:
committed by
Rob Bygrave
parent
d1b7b082a2
commit
ab301f970c
@@ -447,7 +447,21 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
void beanPutAll(Collection<EntityBean> beans) {
|
||||
if (desc.inheritInfo != null) {
|
||||
Class<?> aClass = theClassOf(beans);
|
||||
desc.descOf(aClass).cacheBeanPutAllDirect(beans);
|
||||
// check if all beans have the same class
|
||||
for (EntityBean bean : beans) {
|
||||
if (!bean.getClass().equals(aClass)) {
|
||||
aClass = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aClass == null) {
|
||||
// there are different bean types in the collection, so we add one by one to the cache
|
||||
for (EntityBean bean : beans) {
|
||||
desc.descOf(bean.getClass()).cacheBeanPutDirect(bean);
|
||||
}
|
||||
} else {
|
||||
desc.descOf(aClass).cacheBeanPutAllDirect(beans);
|
||||
}
|
||||
} else {
|
||||
beanCachePutAllDirect(beans);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user