Fix for Issue 72 - Bug - models.Role cannot be cast to java.util.Map [error] at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveAssocManyDetails(DefaultPersister.java:877)

This commit is contained in:
Rob Bygrave committed 2014-01-23 00:50:09 +13:00
1 parent 87a948223c
commit ee96c4afa6
12 files changed
+169 -22

No files matched your search

@@ -970,11 +970,14 @@ public class BeanDescriptor<T> implements MetaBeanInfo {
public void cachePutMany(BeanPropertyAssocMany<?> many, BeanCollection<?> bc, Object parentId) {
BeanDescriptor<?> targetDescriptor = many.getTargetDescriptor();
Collection<?> actualDetails = bc.getActualDetails();
ArrayList<Object> idList = new ArrayList<Object>();
// get the underlying collection of beans (in the List, Set or Map)
Collection<?> actualDetails = bc.getActualDetails();
for (Object bean : actualDetails) {
Object id = targetDescriptor.getId(bean);
idList.add(id);
// Collect the id values
idList.add(targetDescriptor.getId(bean));
}
CachedManyIds ids = new CachedManyIds(idList);
cachePutCachedManyIds(parentId, many.getName(), ids);
@@ -38,6 +38,10 @@ public class ManyType {
}
}
public boolean isMap() {
return Underlying.MAP.equals(underlying);
}
/**
* Return the matching Query type.
*/