public static enum CollectionType {
SET,
LIST,
- MAP;
+ MAP,
+ BAG;
@Override
public String toString() {
}
}
- public static Object getCollectionType(Object obj) {
+ public static Object getCollectionType(Object obj, Class<?> clazz) {
if(obj != null) {
if(obj instanceof List) {
+ //the field in PersistentBag is called "bag" although it is an ArrayList -> #
+ if(clazz.equals(PersistentBag.class)){
+ return CollectionType.BAG;
+ }
return CollectionType.LIST;
}
if(obj instanceof Set) {
if (clazz != null) {
//CollectionField cf = cachedCommonService.getCollectionField(col);
//cachedCommonService.updatePersistentCollection(cf);
- Object collectionType = ProxyUtils.getCollectionType(obj);
+ Object collectionType = ProxyUtils.getCollectionType(obj, clazz);
Field field = clazz.getDeclaredField(collectionType.toString());
field.setAccessible(true);
field.set(this, obj);