/** * ADVANCED: * Set the receiver's update call. * This allows the user to override the update operation. */ public void setUpdateCall(Call call) { if (call == null) { return; } UpdateObjectQuery query = new UpdateObjectQuery(); query.setCall(call); setUpdateQuery(query); }
/** * ADVANCED: * Set the receiver's update call. * This allows the user to override the update operation. */ public void setUpdateCall(Call call) { if (call == null) { return; } UpdateObjectQuery query = new UpdateObjectQuery(); query.setCall(call); setUpdateQuery(query); }
/** * ADVANCED: * Set the receiver's update call. * This allows the user to override the update operation. */ public void setUpdateCall(Call call) { if (call == null) { return; } UpdateObjectQuery query = new UpdateObjectQuery(); query.setCall(call); setUpdateQuery(query); }
/** * ADVANCED: * Set the receiver's update SQL string. * This allows the user to override the SQL generated by EclipseLink, with there own SQL or procedure call. * The arguments are translated from the fields of the source row, * through replacing the field names marked by '#' with the values for those fields. * This must check the optimistic lock field and raise an error on optimistic lock failure. * Warning: Allowing an unverified SQL string to be passed into this * method makes your application vulnerable to SQL injection attacks. * <p> * Example, "update EMPLOYEE set F_NAME to #F_NAME, L_NAME to #L_NAME where EMPLOYEE_ID = #EMPLOYEE_ID". */ public void setUpdateSQLString(String sqlString) { if (sqlString == null) { return; } UpdateObjectQuery query = new UpdateObjectQuery(); query.setSQLString(sqlString); setUpdateQuery(query); }
/** * ADVANCED: * Set the receiver's update SQL string. * This allows the user to override the SQL generated by EclipseLink, with there own SQL or procedure call. * The arguments are translated from the fields of the source row, * through replacing the field names marked by '#' with the values for those fields. * This must check the optimistic lock field and raise an error on optimistic lock failure. * Warning: Allowing an unverified SQL string to be passed into this * method makes your application vulnerable to SQL injection attacks. * <p> * Example, "update EMPLOYEE set F_NAME to #F_NAME, L_NAME to #L_NAME where EMPLOYEE_ID = #EMPLOYEE_ID". */ public void setUpdateSQLString(String sqlString) { if (sqlString == null) { return; } UpdateObjectQuery query = new UpdateObjectQuery(); query.setSQLString(sqlString); setUpdateQuery(query); }
/** * ADVANCED: * Set the receiver's update SQL string. * This allows the user to override the SQL generated by EclipseLink, with there own SQL or procedure call. * The arguments are translated from the fields of the source row, * through replacing the field names marked by '#' with the values for those fields. * This must check the optimistic lock field and raise an error on optimistic lock failure. * Warning: Allowing an unverified SQL string to be passed into this * method makes your application vulnerable to SQL injection attacks. * <p> * Example, "update EMPLOYEE set F_NAME to #F_NAME, L_NAME to #L_NAME where EMPLOYEE_ID = #EMPLOYEE_ID". */ public void setUpdateSQLString(String sqlString) { if (sqlString == null) { return; } UpdateObjectQuery query = new UpdateObjectQuery(); query.setSQLString(sqlString); setUpdateQuery(query); }
/** * PUBLIC: * Update the object and all of its privately owned parts in the database. * Update should only be used if the application knows that the object is new, * otherwise writeObject should be used. * The update operation can be customized through using an update query. * * @exception DatabaseException if an error occurs on the database, * these include constraint violations, security violations and general database errors. * @exception OptimisticLockException if the object's descriptor is using optimistic locking and * the object has been updated or deleted by another user since it was last read. * * @see UpdateObjectQuery * @see #writeObject(Object) */ public Object updateObject(Object domainObject) throws DatabaseException, OptimisticLockException { UpdateObjectQuery query = new UpdateObjectQuery(); query.setObject(domainObject); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Update the object and all of its privately owned parts in the database. * Update should only be used if the application knows that the object is new, * otherwise writeObject should be used. * The update operation can be customized through using an update query. * * @exception DatabaseException if an error occurs on the database, * these include constraint violations, security violations and general database errors. * @exception OptimisticLockException if the object's descriptor is using optimistic locking and * the object has been updated or deleted by another user since it was last read. * * @see UpdateObjectQuery * @see #writeObject(Object) */ public Object updateObject(Object domainObject) throws DatabaseException, OptimisticLockException { UpdateObjectQuery query = new UpdateObjectQuery(); query.setObject(domainObject); query.setIsExecutionClone(true); return executeQuery(query); }
/** * INTERNAL: * An object is still in the collection, update it as it may have changed. */ protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Hashtable backupCloneKeyedCache, CacheKey cachedKey) throws DatabaseException, OptimisticLockException { // Always write for updates, either private or in uow if calling this method. UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setIsExecutionClone(true); Object backupclone = backupCloneKeyedCache.get(cachedKey); updateQuery.setBackupClone(backupclone); prepareModifyQueryForUpdate(query, updateQuery, object); query.getSession().executeQuery(updateQuery, updateQuery.getTranslationRow()); } protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Object backupClone) throws DatabaseException, OptimisticLockException {
/** * INTERNAL: * An object is still in the collection, update it as it may have changed. */ @Override protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Map backupCloneKeyedCache, Object cachedKey) throws DatabaseException, OptimisticLockException { // Always write for updates, either private or in uow if calling this method. UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setIsExecutionClone(true); Object backupclone = backupCloneKeyedCache.get(cachedKey); updateQuery.setBackupClone(backupclone); prepareModifyQueryForUpdate(query, updateQuery, object); query.getSession().executeQuery(updateQuery, updateQuery.getTranslationRow()); }
/** * INTERNAL: * An object is still in the collection, update it as it may have changed. */ @Override protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Map backupCloneKeyedCache, Object cachedKey) throws DatabaseException, OptimisticLockException { // Always write for updates, either private or in uow if calling this method. UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setIsExecutionClone(true); Object backupclone = backupCloneKeyedCache.get(cachedKey); updateQuery.setBackupClone(backupclone); prepareModifyQueryForUpdate(query, updateQuery, object); query.getSession().executeQuery(updateQuery, updateQuery.getTranslationRow()); }
protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Object backupClone) throws DatabaseException, OptimisticLockException { // Always write for updates, either private or in uow if calling this method. UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setIsExecutionClone(true); updateQuery.setBackupClone(backupClone); prepareModifyQueryForUpdate(query, updateQuery, object); query.getSession().executeQuery(updateQuery, updateQuery.getTranslationRow()); }
protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Object backupClone) throws DatabaseException, OptimisticLockException { // Always write for updates, either private or in uow if calling this method. UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setIsExecutionClone(true); updateQuery.setBackupClone(backupClone); prepareModifyQueryForUpdate(query, updateQuery, object); query.getSession().executeQuery(updateQuery, updateQuery.getTranslationRow()); }
protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Object backupClone) throws DatabaseException, OptimisticLockException { // Always write for updates, either private or in uow if calling this method. UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setIsExecutionClone(true); updateQuery.setBackupClone(backupClone); prepareModifyQueryForUpdate(query, updateQuery, object); query.getSession().executeQuery(updateQuery, updateQuery.getTranslationRow()); }
/** * INTERNAL: Generates the update stored procedure for this descriptor */ protected StoredProcedureDefinition generateUpdateStoredProcedure(ClassDescriptor descriptor) { UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setDescriptor(descriptor); updateQuery.setModifyRow(descriptor.getObjectBuilder().buildTemplateUpdateRow(getSession())); return this.generateObjectStoredProcedure(updateQuery, descriptor.getFields(), "UPD_"); }
/** * INTERNAL: Generates the update stored procedure for this descriptor */ protected StoredProcedureDefinition generateUpdateStoredProcedure(ClassDescriptor descriptor) { UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setDescriptor(descriptor); updateQuery.setModifyRow(descriptor.getObjectBuilder().buildTemplateUpdateRow(getSession())); return this.generateObjectStoredProcedure(updateQuery, descriptor.getFields(), "UPD_"); }
/** * INTERNAL: Generates the update stored procedure for this descriptor */ protected StoredProcedureDefinition generateUpdateStoredProcedure(ClassDescriptor descriptor) { UpdateObjectQuery updateQuery = new UpdateObjectQuery(); updateQuery.setDescriptor(descriptor); updateQuery.setModifyRow(descriptor.getObjectBuilder().buildTemplateUpdateRow(getSession())); return this.generateObjectStoredProcedure(updateQuery, descriptor.getFields(), "UPD_"); }
/** * INTERNAL: * Initialize the CMPPolicy settings. */ public void initialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException { // updateAllFields is true so set custom query in DescriptorQueryManager // to force full SQL. Don't overwrite a user defined query if (this.getUpdateAllFields() && !descriptor.getQueryManager().hasUpdateQuery()) { descriptor.getQueryManager().setUpdateQuery(new UpdateObjectQuery()); } // make sure updateAllFields is set if forceUpdate is true if (this.getForceUpdate() && !this.getUpdateAllFields()) { throw DescriptorException.updateAllFieldsNotSet(descriptor); } }
/** * INTERNAL: * Initialize the CMPPolicy settings. */ public void initialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException { // updateAllFields is true so set custom query in DescriptorQueryManager // to force full SQL. Don't overwrite a user defined query if (this.getUpdateAllFields() && !descriptor.getQueryManager().hasUpdateQuery()) { descriptor.getQueryManager().setUpdateQuery(new UpdateObjectQuery()); } // make sure updateAllFields is set if forceUpdate is true if (this.getForceUpdate() && !this.getUpdateAllFields()) { throw DescriptorException.updateAllFieldsNotSet(descriptor); } }
/** * INTERNAL: * Initialize the CMPPolicy settings. */ public void initialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException { // updateAllFields is true so set custom query in DescriptorQueryManager // to force full SQL. Don't overwrite a user defined query if (this.getUpdateAllFields() && !descriptor.getQueryManager().hasUpdateQuery()) { descriptor.getQueryManager().setUpdateQuery(new UpdateObjectQuery()); } // make sure updateAllFields is set if forceUpdate is true if (this.getForceUpdate() && !this.getUpdateAllFields()) { throw DescriptorException.updateAllFieldsNotSet(descriptor); } }