/** * 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); }
/** * PUBLIC: * Read the first instance of the class from the database. * This operation can be customized through using a ReadObjectQuery, * or through also passing in a selection criteria. * * @see ReadObjectQuery * @see #readAllObjects(Class, Expression) */ public Object readObject(Class domainClass) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database. * This operation can be customized through using a ReadObjectQuery, * or through also passing in a selection criteria. * * @see ReadObjectQuery * @see #readAllObjects(Class, Expression) */ public Object readObject(Class domainClass) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database. * This operation can be customized through using a ReadObjectQuery, * or through also passing in a selection criteria. * * @see ReadObjectQuery * @see #readAllObjects(Class, Expression) */ @Override public Object readObject(Class domainClass) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database matching the given expression. * This operation can be customized through using a ReadObjectQuery. * * @see ReadObjectQuery */ public Object readObject(Class domainClass, Expression expression) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setSelectionCriteria(expression); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database returned through execution the Call string. * The Call can be an SQLCall or JPQLCall. * * example: session.readObject(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE")); * @see SQLCall * @see JPQLCall */ public Object readObject(Class domainClass, Call aCall) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setCall(aCall); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database returned through execution the Call string. * The Call can be an SQLCall or JPQLCall. * * example: session.readObject(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE")); * @see SQLCall * @see JPQLCall */ @Override public Object readObject(Class domainClass, Call aCall) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setCall(aCall); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database matching the given expression. * This operation can be customized through using a ReadObjectQuery. * * @see ReadObjectQuery */ public Object readObject(Class domainClass, Expression expression) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setSelectionCriteria(expression); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database matching the given expression. * This operation can be customized through using a ReadObjectQuery. * * @see ReadObjectQuery */ @Override public Object readObject(Class domainClass, Expression expression) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setSelectionCriteria(expression); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database return through execution the SQL string. * The SQL string must be a valid SQL select statement or selecting stored procedure call. * This operation can be customized through using a ReadObjectQuery. * Warning: Allowing an unverified SQL string to be passed into this * method makes your application vulnerable to SQL injection attacks. * * @see ReadObjectQuery */ public Object readObject(Class domainClass, String sqlString) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setSQLString(sqlString); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Read the first instance of the class from the database returned through execution the Call string. * The Call can be an SQLCall or JPQLCall. * * example: session.readObject(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE")); * @see SQLCall * @see JPQLCall */ public Object readObject(Class domainClass, Call aCall) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(domainClass); query.setCall(aCall); query.setIsExecutionClone(true); return executeQuery(query); }
/** * Build a selection query using the given properties. */ protected ReadObjectQuery getReadObjectQuery(Map properties) { ReadObjectQuery query = new ReadObjectQuery(); // Apply the properties if there are some. QueryHintsHandler.apply(properties, query, this.databaseSession.getDatasourcePlatform().getConversionManager().getLoader(), this.databaseSession); query.setIsExecutionClone(true); return query; }
/** * INTERNAL: * Check if the object is invalid and refresh it. * This is used to ensure that no invalid objects are registered. */ public void checkAndRefreshInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor) { if (isConsideredInvalid(object, cacheKey, descriptor)) { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(object.getClass()); query.setSelectionId(cacheKey.getKey()); query.refreshIdentityMapResult(); query.setIsExecutionClone(true); this.executeQuery(query); } }
/** * INTERNAL: * This method is used to load a relationship from a list of PKs. * This list may be available if the relationship has been cached. */ @Override public Object valueFromPKList(Object[] pks, AbstractRecord foreignKeys, AbstractSession session) { if (pks.length == 0 || pks[0] == null) return null; ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(getReferenceClass()); query.setSelectionId(pks[0]); query.setIsExecutionClone(true); query.setSession(session); return session.executeQuery(query); }
/** * INTERNAL: * This method is used to load a relationship from a list of PKs. * This list may be available if the relationship has been cached. */ @Override public Object valueFromPKList(Object[] pks, AbstractRecord foreignKeys, AbstractSession session) { if (pks.length == 0 || pks[0] == null) return null; ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(getReferenceClass()); query.setSelectionId(pks[0]); query.setIsExecutionClone(true); query.setSession(session); return session.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); }
/** * 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); }