List of usage examples for org.hibernate.collection.internal AbstractPersistentCollection getKey
@Override public final Serializable getKey()
From source file:ch.algotrader.cache.CollectionHandler.java
License:Open Source License
@Override protected CacheResponse initialize(Object obj) { if (!(obj instanceof AbstractPersistentCollection)) { throw new IllegalArgumentException("none PersistentCollection passed " + obj); }//from w w w . ja v a 2 s.c o m AbstractPersistentCollection col = (AbstractPersistentCollection) obj; if (col.wasInitialized()) { throw new IllegalArgumentException("PersistentCollection is already initialized " + obj); } if (col.getRole() == null) { throw new IllegalArgumentException("missing role on " + obj); } synchronized (obj) { Object initializedObj = this.cacheManager.getGenericDao().getInitializedCollection(col.getRole(), (Long) col.getKey()); CacheResponse response = this.cacheManager.put(initializedObj); if (response.getState() == CacheState.EXISTING) { return response; } else { return CacheResponse.updatedObject(initializedObj); } } }