boolean isHinted(FetchConfiguration fetch, String hint) { if (fetch == null) return false; Object result = fetch.getHint(hint); return result != null && "true".equalsIgnoreCase(result.toString()); }
/** * Return whether to use a transactional state. */ private boolean useTransactionalState(FetchConfiguration fetch) { return (_flags & FLAG_ACTIVE) != 0 && (!_optimistic || _autoClear == CLEAR_ALL || fetch.getReadLockLevel() != LOCK_NONE); }
public int requiresFetch(FieldMetaData fmd) { try { return _fetch.requiresFetch(fmd); } catch (RuntimeException re) { throw translate(re); } }
public void copy(FetchConfiguration fetch) { setFetchBatchSize(fetch.getFetchBatchSize()); setMaxFetchDepth(fetch.getMaxFetchDepth()); setQueryCacheEnabled(fetch.getQueryCacheEnabled()); setFlushBeforeQueries(fetch.getFlushBeforeQueries()); setExtendedPathLookup(fetch.getExtendedPathLookup()); setLockTimeout(fetch.getLockTimeout()); setQueryTimeout(fetch.getQueryTimeout()); setLockScope(fetch.getLockScope()); clearFetchGroups(false); addFetchGroups(fetch.getFetchGroups()); clearFields(); copyHints(fetch); setCacheRetrieveMode(fetch.getCacheRetrieveMode()); setCacheStoreMode(fetch.getCacheStoreMode()); addFields(fetch.getFields()); // don't use setters because require active transaction _state.readLockLevel = fetch.getReadLockLevel(); _state.writeLockLevel = fetch.getWriteLockLevel(); }
public void lockAll(Collection objs, OpCallbacks call) { if (objs.isEmpty()) return; beginOperation(true); // have to sync or lock level always NONE try { lockAll(objs, _fc.getWriteLockLevel(), _fc.getLockTimeout(), call); } finally { endOperation(); } }
private boolean containsEmbeddedResult(FetchConfiguration fetch, Result res) { FieldMapping[] fields = field.getEmbeddedMapping().getFieldMappings(); boolean containsUnloadedEagerField = false; for (int i = 0; i < fields.length; i++) { boolean inResultSet = checkResult(fields[i],res); if (inResultSet) { // At least one of the embeddable's field is in the ResultSet. return true; } if (fetch.requiresFetch(fields[i]) == FetchConfiguration.FETCH_LOAD) { containsUnloadedEagerField = true; } } // A field expected to be loaded eagerly was missing from the ResultSet. if (containsUnloadedEagerField == true) { return false; } // if all fields are lazy and in the default fetch group, populate the embeddable // so its attributes can be loaded when accessed. return fetch.hasFetchGroup(FetchGroup.NAME_DEFAULT); }
public int getFlushBeforeQueries() { try { return _fetch.getFlushBeforeQueries(); } catch (RuntimeException re) { throw translate(re); } }
public FetchConfiguration setFlushBeforeQueries(int flush) { try { _fetch.setFlushBeforeQueries(flush); return this; } catch (RuntimeException re) { throw translate(re); } }
public void copy(FetchConfiguration fetch) { try { _fetch.copy(fetch); } catch (RuntimeException re) { throw translate(re); } }
/** * Return whether this should be treated as a potential large result set. */ private boolean isLRS(long start, long end) { long range = end - start; return _fc.getFetchBatchSize() >= 0 && !(range <= _fc.getFetchBatchSize() || (_fc.getFetchBatchSize() == 0 && range <= 50)); }
FieldMetaData fmd = _meta.getField(field); if (fmd.isInDefaultFetchGroup() && fetch.hasFetchGroup(FetchGroup.NAME_DEFAULT) && postLoad(FetchGroup.NAME_DEFAULT, fetch)) return; String[] fgs = fmd.getCustomFetchGroups(); for (int i = 0; i < fgs.length; i++) if (fetch.hasFetchGroup(fgs[i]) && postLoad(fgs[i], fetch)) return; } else { for (Iterator itr = fetch.getFetchGroups().iterator(); itr.hasNext();) { if (postLoad((String) itr.next(), fetch))
public boolean hasFetchGroup(String group) { try { return _fetch.hasFetchGroup(group); } catch (RuntimeException re) { throw translate(re); } }
public int getLockScope() { try { return _fetch.getLockScope(); } catch (RuntimeException re) { throw translate(re); } }
public int getLockTimeout() { try { return _fetch.getLockTimeout(); } catch (RuntimeException re) { throw translate(re); } }
public void copy(FetchConfiguration fetch) { setFetchBatchSize(fetch.getFetchBatchSize()); setMaxFetchDepth(fetch.getMaxFetchDepth()); setQueryCacheEnabled(fetch.getQueryCacheEnabled()); setFlushBeforeQueries(fetch.getFlushBeforeQueries()); setExtendedPathLookup(fetch.getExtendedPathLookup()); setLockTimeout(fetch.getLockTimeout()); setQueryTimeout(fetch.getQueryTimeout()); setLockScope(fetch.getLockScope()); clearFetchGroups(false); addFetchGroups(fetch.getFetchGroups()); clearFields(); copyHints(fetch); setCacheRetrieveMode(fetch.getCacheRetrieveMode()); setCacheStoreMode(fetch.getCacheStoreMode()); addFields(fetch.getFields()); // don't use setters because require active transaction _state.readLockLevel = fetch.getReadLockLevel(); _state.writeLockLevel = fetch.getWriteLockLevel(); }
public void lockAll(Collection objs, OpCallbacks call) { if (objs.isEmpty()) return; beginOperation(true); // have to sync or lock level always NONE try { lockAll(objs, _fc.getWriteLockLevel(), _fc.getLockTimeout(), call); } finally { endOperation(); } }
private boolean containsEmbeddedResult(FetchConfiguration fetch, Result res) { FieldMapping[] fields = field.getEmbeddedMapping().getFieldMappings(); boolean containsUnloadedEagerField = false; for (int i = 0; i < fields.length; i++) { boolean inResultSet = checkResult(fields[i],res); if (inResultSet) { // At least one of the embeddable's field is in the ResultSet. return true; } if (fetch.requiresFetch(fields[i]) == FetchConfiguration.FETCH_LOAD) { containsUnloadedEagerField = true; } } // A field expected to be loaded eagerly was missing from the ResultSet. if (containsUnloadedEagerField == true) { return false; } // if all fields are lazy and in the default fetch group, populate the embeddable // so its attributes can be loaded when accessed. return fetch.hasFetchGroup(FetchGroup.NAME_DEFAULT); }
public int getFlushBeforeQueries() { try { return _fetch.getFlushBeforeQueries(); } catch (RuntimeException re) { throw translate(re); } }
public FetchConfiguration setFlushBeforeQueries(int flush) { try { _fetch.setFlushBeforeQueries(flush); return this; } catch (RuntimeException re) { throw translate(re); } }
public void copy(FetchConfiguration fetch) { try { _fetch.copy(fetch); } catch (RuntimeException re) { throw translate(re); } }