/** * PUBLIC: * Return a query to read the object with the same primary key as the provided object. * Note: This is not a query by example object, only the primary key will be used for the selection criteria. */ public ReadObjectQuery(Object objectToRead) { this(); setSelectionObject(objectToRead); }
/** * PUBLIC: * Return a query to read the object with the same primary key as the provided object. * Note: This is not a query by example object, only the primary key will be used for the selection criteria. */ public ReadObjectQuery(Object objectToRead) { this(); setSelectionObject(objectToRead); }
/** * PUBLIC: * Return a query to read the object with the same primary key as the provided object. * Note: This is not a query by example object, only the primary key will be used for the selection criteria. */ public ReadObjectQuery(Object objectToRead) { this(); setSelectionObject(objectToRead); }
/** * Build a selection query for the given entity. */ protected ReadObjectQuery getReadObjectQuery(Object entity, Map properties) { ReadObjectQuery query = getReadObjectQuery(properties); query.setSelectionObject(entity); return query; }
/** * PUBLIC: * Use the example object to consruct a read object query by the objects primary key. * This will read the object from the database with the same primary key as the object * or null if no object is found. */ public Object readObject(Object object) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Use the example object to consruct a read object query by the objects primary key. * This will read the object from the database with the same primary key as the object * or null if no object is found. */ public Object readObject(Object object) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Use the example object to consruct a read object query by the objects primary key. * This will read the object from the database with the same primary key as the object * or null if no object is found. */ @Override public Object readObject(Object object) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.setIsExecutionClone(true); return executeQuery(query); }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ protected void prePrepare() throws QueryException { super.prePrepare(); //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && getSession().getProject().hasProxyIndirection()) { setSelectionObject(ProxyIndirectionPolicy.getValueFromProxy(getSelectionObject())); } }
/** * PUBLIC: * Refresh the attributes of the object and of all of its private parts from the database. * The object will be pessimisticly locked on the database for the duration of the transaction. * <p>Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT */ public Object refreshAndLockObject(Object object, short lockMode) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.refreshIdentityMapResult(); query.cascadePrivateParts(); query.setLockMode(lockMode); query.setIsExecutionClone(true); return executeQuery(query); }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ protected void prePrepare() throws QueryException { super.prePrepare(); //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && getSession().getProject().hasProxyIndirection()) { setSelectionObject(ProxyIndirectionPolicy.getValueFromProxy(getSelectionObject())); } }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ protected void prePrepare() throws QueryException { super.prePrepare(); //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && getSession().getProject().hasProxyIndirection()) { setSelectionObject(ProxyIndirectionPolicy.getValueFromProxy(getSelectionObject())); } }
/** * PUBLIC: * Refresh the attributes of the object and of all of its private parts from the database. * The object will be pessimisticly locked on the database for the duration of the transaction. * <p>Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT */ public Object refreshAndLockObject(Object object, short lockMode) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.refreshIdentityMapResult(); query.cascadePrivateParts(); query.setLockMode(lockMode); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Refresh the attributes of the object and of all of its private parts from the database. * The object will be pessimisticly locked on the database for the duration of the transaction. * <p>Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT */ public Object refreshAndLockObject(Object object, short lockMode) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.refreshIdentityMapResult(); query.cascadePrivateParts(); query.setLockMode(lockMode); query.setIsExecutionClone(true); return executeQuery(query); }
UnitOfWork uow = xrService.getORSession().acquireUnitOfWork(); ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(instance); query.setIsExecutionClone(true); FetchGroup simpleFetchGroup = new FetchGroup();
UnitOfWork uow = xrService.getORSession().acquireUnitOfWork(); ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(instance); query.setIsExecutionClone(true); FetchGroup simpleFetchGroup = new FetchGroup();
/** * INTERNAL: * Set the properties needed to be cascaded into the custom query inlucding the translation row. */ protected void prepareCustomQuery(DatabaseQuery customQuery) { ReadObjectQuery customReadQuery = (ReadObjectQuery)customQuery; customReadQuery.setShouldRefreshIdentityMapResult(shouldRefreshIdentityMapResult()); customReadQuery.setCascadePolicy(getCascadePolicy()); customReadQuery.setShouldMaintainCache(shouldMaintainCache()); customReadQuery.setShouldUseWrapperPolicy(shouldUseWrapperPolicy()); // CR... was missing some values, execution could cause infinite loop. customReadQuery.setQueryId(getQueryId()); customReadQuery.setExecutionTime(getExecutionTime()); customReadQuery.setShouldLoadResultIntoSelectionObject(shouldLoadResultIntoSelectionObject()); AbstractRecord primaryKeyRow; if (getSelectionObject() != null) { // CR#... Must also set the selection object as may be loading into the object (refresh) customReadQuery.setSelectionObject(getSelectionObject()); // The translation/primary key row will be set in prepareForExecution. } else if (getSelectionKey() != null) { customReadQuery.setSelectionKey(getSelectionKey()); } else { // The primary key row must be used. primaryKeyRow = customQuery.getDescriptor().getObjectBuilder().extractPrimaryKeyRowFromExpression(getSelectionCriteria(), customQuery.getTranslationRow(), customReadQuery.getSession()); customReadQuery.setTranslationRow(primaryKeyRow); } }