public DataCachePCData get(Object oid) { if (_cache == null) return null; try { return _cache.get(oid); } catch (RuntimeException re) { throw translate(re); } }
DataCachePCData data = cache.get(sm.getObjectId()); if (lockLevel == LockLevels.LOCK_NONE && !isLocking(fetch) && data != null) data.load(sm, fields, fetch, edata);
public DataCachePCData get(Object oid) { if (_cache == null) return null; try { return _cache.get(oid); } catch (RuntimeException re) { throw translate(re); } }
DataCachePCData data = cache.get(sm.getObjectId()); if (lockLevel == LockLevels.LOCK_NONE && !isLocking(fetch) && data != null) data.load(sm, fields, fetch, edata);
public DataCachePCData get(Object oid) { if (_cache == null) return null; try { return _cache.get(oid); } catch (RuntimeException re) { throw translate(re); } }
data = cache.get(sm.getObjectId()); if (!isLocking(null) && data != null) version = data.getVersion();
public DataCachePCData get(Object oid) { if (_cache == null) return null; try { return _cache.get(oid); } catch (RuntimeException re) { throw translate(re); } }
public DataCachePCData get(Object oid) { if (_cache == null) return null; try { return _cache.get(oid); } catch (RuntimeException re) { throw translate(re); } }
/** * Return whether the given field is loaded for the given instance. */ private boolean isLoaded(OpenJPAStateManager sm, int field) { if (sm.getLoaded().get(field)) return true; // if the field isn't loaded in the state manager, it still might be // loaded in the data cache, in which case we still have to correct // it to keep the cache in sync DataCache cache = _mgr.selectCache(sm); if (cache == null) return false; // can't retrieve an embedded object directly, so always assume the // field is loaded and needs to be corrected if (sm.isEmbedded()) return true; PCData pc = cache.get(sm.getObjectId()); if (pc == null) return false; return pc.isLoaded(field); }
/** * Return whether the given field is loaded for the given instance. */ private boolean isLoaded(OpenJPAStateManager sm, int field) { if (sm.getLoaded().get(field)) return true; // if the field isn't loaded in the state manager, it still might be // loaded in the data cache, in which case we still have to correct // it to keep the cache in sync DataCache cache = _mgr.selectCache(sm); if (cache == null) return false; // can't retrieve an embedded object directly, so always assume the // field is loaded and needs to be corrected if (sm.isEmbedded()) return true; PCData pc = cache.get(sm.getObjectId()); if (pc == null) return false; return pc.isLoaded(field); }
/** * Return whether the given field is loaded for the given instance. */ private boolean isLoaded(OpenJPAStateManager sm, int field) { if (sm.getLoaded().get(field)) return true; // if the field isn't loaded in the state manager, it still might be // loaded in the data cache, in which case we still have to correct // it to keep the cache in sync DataCache cache = _mgr.selectCache(sm); if (cache == null) return false; // can't retrieve an embedded object directly, so always assume the // field is loaded and needs to be corrected if (sm.isEmbedded()) return true; PCData pc = cache.get(sm.getObjectId()); if (pc == null) return false; return pc.isLoaded(field); }
/** * Return whether the given field is loaded for the given instance. */ private boolean isLoaded(OpenJPAStateManager sm, int field) { if (sm.getLoaded().get(field)) return true; // if the field isn't loaded in the state manager, it still might be // loaded in the data cache, in which case we still have to correct // it to keep the cache in sync DataCache cache = _mgr.selectCache(sm); if (cache == null) return false; // can't retrieve an embedded object directly, so always assume the // field is loaded and needs to be corrected if (sm.isEmbedded()) return true; PCData pc = cache.get(sm.getObjectId()); if (pc == null) return false; return pc.isLoaded(field); }
/** * Return whether the given field is loaded for the given instance. */ private boolean isLoaded(OpenJPAStateManager sm, int field) { if (sm.getLoaded().get(field)) return true; // if the field isn't loaded in the state manager, it still might be // loaded in the data cache, in which case we still have to correct // it to keep the cache in sync DataCache cache = sm.getMetaData().getDataCache(); if (cache == null) return false; // can't retrieve an embedded object directly, so always assume the // field is loaded and needs to be corrected if (sm.isEmbedded()) return true; PCData pc = cache.get(sm.getObjectId()); if (pc == null) return false; return pc.isLoaded(field); }
public boolean syncVersion(OpenJPAStateManager sm, Object edata) { DataCache cache = sm.getMetaData().getDataCache(); if (cache == null || sm.isEmbedded()) return super.syncVersion(sm, edata); DataCachePCData data; Object version = null; data = cache.get(sm.getObjectId()); if (!isLocking(null) && data != null) version = data.getVersion(); // if we have a cached version update from there if (version != null) { if (!version.equals(sm.getVersion())) { sm.setVersion(version); return false; } return true; } // use data store version return super.syncVersion(sm, edata); }
/** * Check if this field is in use of "order by" by other field collections * in inverse relation. If it is, clear the other field cache because it * could be out of order. */ protected void clearInverseRelationCache(OpenJPAStateManager sm, FieldMetaData fmd) { DataCache cache = sm.getMetaData().getDataCache(); if (cache == null) return; ClassMetaData cmd = sm.getMetaData(); FieldMetaData[] fields = cmd.getFields(); for (int i = 0; i < fields.length; i++) { FieldMetaData[] inverses = fields[i].getInverseMetaDatas(); if (inverses.length == 0) continue; for (FieldMetaData inverse : inverses) { if (inverse.getOrderDeclaration().indexOf(fmd.getName()) != -1) { Object oid = sm.getContext().getObjectId(sm.fetch(i)); DataCachePCData data = cache.get(oid); if (data instanceof DataCachePCDataImpl) { ((DataCachePCDataImpl) data).clearData(inverse.getIndex()); } } } } }
/** * Check if this field is in use of "order by" by other field collections * in inverse relation. If it is, clear the other field cache because it * could be out of order. */ protected void clearInverseRelationCache(OpenJPAStateManager sm, FieldMetaData fmd) { DataCache cache = sm.getMetaData().getDataCache(); if (cache == null) return; ClassMetaData cmd = sm.getMetaData(); FieldMetaData[] fields = cmd.getFields(); for (int i = 0; i < fields.length; i++) { FieldMetaData[] inverses = fields[i].getInverseMetaDatas(); if (inverses.length == 0) continue; for (FieldMetaData inverse : inverses) { if (inverse.getOrderDeclaration().indexOf(fmd.getName()) != -1) { Object oid = sm.getContext().getObjectId(sm.fetch(i)); DataCachePCData data = cache.get(oid); if (data instanceof DataCachePCDataImpl) { ((DataCachePCDataImpl) data).clearData(inverse.getIndex()); } } } } }
/** * Check if this field is in use of "order by" by other field collections * in inverse relation. If it is, clear the other field cache because it * could be out of order. */ protected void clearInverseRelationCache(OpenJPAStateManager sm, FieldMetaData fmd) { DataCache cache = sm.getMetaData().getDataCache(); if (cache == null) return; ClassMetaData cmd = sm.getMetaData(); FieldMetaData[] fields = cmd.getFields(); for (int i = 0; i < fields.length; i++) { FieldMetaData[] inverses = fields[i].getInverseMetaDatas(); if (inverses.length == 0) continue; for (FieldMetaData inverse : inverses) { if (inverse.getOrderDeclaration().indexOf(fmd.getName()) != -1) { Object oid = sm.getContext().getObjectId(sm.fetch(i)); DataCachePCData data = cache.get(oid); if (data instanceof DataCachePCDataImpl) { ((DataCachePCDataImpl) data).clearData(inverse.getIndex()); } } } } }
/** * Check if this field is in use of "order by" by other field collections * in inverse relation. If it is, clear the other field cache because it * could be out of order. */ protected void clearInverseRelationCache(OpenJPAStateManager sm, FieldMetaData fmd) { ClassMetaData cmd = sm.getMetaData(); FieldMetaData[] fields = cmd.getFields(); for (int i = 0; i < fields.length; i++) { FieldMetaData[] inverses = fields[i].getInverseMetaDatas(); if (inverses.length == 0) continue; for (int j = 0; j < inverses.length; j++) { if (inverses[j].getOrderDeclaration() .indexOf(fmd.getName()) != -1) { DataCache cache = sm.getMetaData().getDataCache(); Object oid = sm.getContext().getObjectId(sm.fetch(i)); DataCachePCData data = cache == null ? null : cache.get(oid); if ((data != null) && (data instanceof DataCachePCDataImpl)) { ((DataCachePCDataImpl) data) .clearData(inverses[j].getIndex()); } } } } }
/** * Check if this field is in use of "order by" by other field collections * in inverse relation. If it is, clear the other field cache because it * could be out of order. */ protected void clearInverseRelationCache(OpenJPAStateManager sm, FieldMetaData fmd) { DataCache cache = sm.getMetaData().getDataCache(); if (cache == null) return; ClassMetaData cmd = sm.getMetaData(); FieldMetaData[] fields = cmd.getFields(); for (int i = 0; i < fields.length; i++) { FieldMetaData[] inverses = fields[i].getInverseMetaDatas(); if (inverses.length == 0) continue; for (FieldMetaData inverse : inverses) { if (inverse.getOrderDeclaration().indexOf(fmd.getName()) != -1) { Object oid = sm.getContext().getObjectId(sm.fetch(i)); DataCachePCData data = cache.get(oid); if (data instanceof DataCachePCDataImpl) { ((DataCachePCDataImpl) data).clearData(inverse.getIndex()); } } } } }