public boolean isInitialized(Object o) { if (o instanceof PersistentCollection) return ((PersistentCollection<?>)o).wasInitialized(); Class<?> cls = o.getClass(); if (!isEntity(cls)) return true; Property property = getInitializedProperty(cls, false); if (property == null) return true; try { return property.getBoolean(o); } catch (Exception e) { throw new PropertyAccessException("Could not get " + property + " of object " + o, e); } }
if (obj instanceof PersistentCollection && !((PersistentCollection<?>)obj).wasInitialized()) return removed;
public boolean isInitialized(Object o) { if (o instanceof PersistentCollection) return ((PersistentCollection)o).wasInitialized(); Class<?> cls = o.getClass(); if (!isEntity(cls)) return true; Property property = getInitializedProperty(cls, false); if (property == null) return true; try { return property.getBoolean(o); } catch (Exception e) { throw new PropertyAccessException("Could not get " + property + " of object " + o, e); } }
public boolean isInitialized(Object o) { if (o instanceof PersistentCollection) return ((PersistentCollection<?>)o).wasInitialized(); Class<?> cls = o.getClass(); if (!isEntity(cls)) return true; Property property = getInitializedProperty(cls, false); if (property == null) return true; try { return property.getBoolean(o); } catch (Exception e) { throw new PropertyAccessException("Could not get " + property + " of object " + o, e); } }
if ((val1 instanceof PersistentCollection && !((PersistentCollection<?>)val1).wasInitialized()) || (val2 instanceof PersistentCollection && !((PersistentCollection<?>)val2).wasInitialized())) return false; Collection<?> coll1 = (Collection<?>)val1; if ((val1 instanceof PersistentCollection && !((PersistentCollection<?>)val1).wasInitialized()) || (val2 instanceof PersistentCollection && !((PersistentCollection<?>)val2).wasInitialized())) return false; List<?> list1 = (List<?>)val1; if ((val1 instanceof PersistentCollection && !((PersistentCollection<?>)val1).wasInitialized()) || (val2 instanceof PersistentCollection && !((PersistentCollection<?>)val2).wasInitialized())) return false; Collection<?> coll1 = (Collection<?>)val1; if ((val1 instanceof PersistentCollection && !((PersistentCollection<?>)val1).wasInitialized()) || (val2 instanceof PersistentCollection && !((PersistentCollection<?>)val2).wasInitialized())) return false; Map<?, ?> map1 = (Map<?, ?>)val1;
save.put(propName, mergeContext.getFromCache(sourceValue)); else if (sourceValue instanceof Collection<?> && !(sourceValue instanceof PersistentCollection && !((PersistentCollection<?>)sourceValue).wasInitialized())) { List<Object> snapshot = new ArrayList<Object>((Collection<?>)sourceValue); save.put(propName, snapshot); else if (sourceValue instanceof Map<?, ?> && !(sourceValue instanceof PersistentCollection && !((PersistentCollection<?>)sourceValue).wasInitialized())) { Map<?, ?> map = (Map<?, ?>)sourceValue; List<Object[]> snapshot = new ArrayList<Object[]>(map.size());
if (value instanceof PersistentCollection && !((PersistentCollection<?>)value).wasInitialized()) continue; if (value instanceof PersistentCollection && !((PersistentCollection<?>)value).wasInitialized()) continue;
for (Object[] owner : owners) { Object val = dataManager.getPropertyValue(owner[0], (String)owner[1]); if (val instanceof PersistentCollection && !((PersistentCollection<?>)val).wasInitialized()) continue; if (val instanceof List<?>) {
mergeContext.pushMerge(coll, previous); if (previous instanceof PersistentCollection && ((PersistentCollection<Set<?>>)previous).wasInitialized()) { log.debug("uninitialize lazy collection %s", ObjectUtil.toString(previous)); ((PersistentCollection<Set<?>>)previous).uninitialize(); if (previous != null && previous instanceof PersistentCollection && !((PersistentCollection<Set<?>>)previous).wasInitialized()) { log.debug("initialize lazy collection %s", ObjectUtil.toString(previous)); mergeContext.pushMerge(coll, previous);
if (graph instanceof PersistentCollection && !((PersistentCollection<?>)graph).wasInitialized()) return null; if (graph.getClass().isArray()) {
mergeContext.pushMerge(coll, previous); if (previous instanceof PersistentCollection && ((PersistentCollection<List<?>>)previous).wasInitialized()) { log.debug("uninitialize lazy collection %s", ObjectUtil.toString(previous)); ((PersistentCollection<List<?>>)previous).uninitialize(); if (previous != null && previous instanceof PersistentCollection && !((PersistentCollection<List<?>>)previous).wasInitialized()) { log.debug("initialize lazy collection %s", ObjectUtil.toString(previous)); mergeContext.pushMerge(coll, previous);
if (previous instanceof PersistentCollection && ((PersistentCollection<Map<?, ?>>)previous).wasInitialized()) { log.debug("uninitialize lazy map %s", ObjectUtil.toString(previous)); ((PersistentCollection<Map<?, ?>>)previous).uninitialize(); if (previous != null && previous instanceof PersistentCollection && !((PersistentCollection<Map<?, ?>>)previous).wasInitialized()) { log.debug("initialize lazy map %s", ObjectUtil.toString(previous)); mergeContext.pushMerge(map, previous);
if (previous instanceof PersistentCollection) { mergeContext.pushMerge(coll, previous); if (((PersistentCollection<?>)previous).wasInitialized()) { if (mergeContext.isUninitializeAllowed() && mergeContext.hasVersionChanged(parent)) { log.debug("uninitialize lazy collection %s", ObjectUtil.toString(previous)); if (pcoll.wasInitialized()) { if (pcoll instanceof List<?>) { List<Object> plist = (List<Object>)pcoll;
if (coll instanceof PersistentCollection && !((PersistentCollection<?>)coll).wasInitialized()) { && ((PersistentCollection<?>)mergeContext.getDataManager().getPropertyValue(receivedEntity, p)).wasInitialized()) mergedColl = (List<Object>)mergeContext.getDataManager().getPropertyValue(receivedEntity, p); else { && ((PersistentCollection<?>)mergeContext.getDataManager().getPropertyValue(receivedEntity, p)).wasInitialized()) mergedColl = (Set<Object>)mergeContext.getDataManager().getPropertyValue(receivedEntity, p); else { && ((PersistentCollection<?>)mergeContext.getDataManager().getPropertyValue(receivedEntity, p)).wasInitialized()) mergedMap = (Map<Object, Object>)mergeContext.getDataManager().getPropertyValue(receivedEntity, p); else {
next = null; else if (((obj instanceof PersistentCollection && !((PersistentCollection<?>)obj).wasInitialized()) || (obj instanceof PersistentCollection && !(previous instanceof PersistentCollection))) && isEntity(parent) && propertyName != null) { next = mergePersistentCollection(mergeContext, (PersistentCollection<?>)obj, previous, parent, propertyName);