Project

General

Profile

« Previous | Next » 

Revision db305a52

Added by Patrick Plitzner about 6 years ago

Add support for PersistentBag #5781

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/ProxyUtils.java
48 48
    public static enum CollectionType {
49 49
        SET,
50 50
        LIST,
51
        MAP;
51
        MAP,
52
        BAG;
52 53

  
53 54
        @Override
54 55
        public String toString() {
......
56 57
        }
57 58
    }
58 59

  
59
    public static Object getCollectionType(Object obj) {
60
    public static Object getCollectionType(Object obj, Class<?> clazz) {
60 61
        if(obj != null) {
61 62
            if(obj instanceof List) {
63
            	//the field in PersistentBag is called "bag" although it is an ArrayList -> #
64
            	if(clazz.equals(PersistentBag.class)){
65
            		return CollectionType.BAG;
66
            	}
62 67
                return CollectionType.LIST;
63 68
            }
64 69
            if(obj instanceof Set) {
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java
1347 1347
				if (clazz != null) {
1348 1348
					//CollectionField cf = cachedCommonService.getCollectionField(col);
1349 1349
					//cachedCommonService.updatePersistentCollection(cf);
1350
				    Object collectionType = ProxyUtils.getCollectionType(obj);
1350
				    Object collectionType = ProxyUtils.getCollectionType(obj, clazz);
1351 1351
					Field field = clazz.getDeclaredField(collectionType.toString());
1352 1352
					field.setAccessible(true);
1353 1353
					field.set(this, obj);

Also available in: Unified diff