public boolean loadEntity(EntityEnterpriseContext ctx, boolean failIfNotFound) { // is any on the data already in the entity valid if(!ctx.isValid()) { if(log.isTraceEnabled()) { log.trace("RESET PERSISTENCE CONTEXT: id=" + ctx.getId()); } entityBridge.resetPersistenceContext(ctx); } // mark the entity as created; if it was loading it was created JDBCEntityBridge.setCreated(ctx); return loadEntityCommand.execute(ctx, failIfNotFound); }
public Object getValue(EntityEnterpriseContext ctx) { Object value = getInstanceValue(ctx); if(ctx.isValid()) { lockingStrategy.accessed(this, ctx); if(checkDirtyAfterGet) { setDirtyAfterGet(ctx); } } return value; }
public int setInstanceParameters(PreparedStatement ps, int parameterIndex, EntityEnterpriseContext ctx) { Object value; if(ctx.isValid()) { // update // generate new value unless it is already provided by the user value = isDirty(ctx) ? getInstanceValue(ctx) : updateVersion(ctx); } else { // create value = getInstanceValue(ctx); } return setArgumentParameters(ps, parameterIndex, value); }
public void setValue(EntityEnterpriseContext ctx, Object value) { if(isReadOnly()) { throw new EJBException("Field is read-only: fieldName=" + fieldName); } if(primaryKeyMember && JDBCEntityBridge.isEjbCreateDone(ctx)) { throw new IllegalStateException("A CMP field that is a member " + "of the primary key can only be set in ejbCreate " + "[EJB 2.0 Spec. 10.3.5]."); } if(ctx.isValid()) { if(!isLoaded(ctx)) { // the field must be loaded for dirty cheking to work properly manager.loadField(this, ctx); } lockingStrategy.changed(this, ctx); } setInstanceValue(ctx, value); }
log.trace("invoke called for ctx " + ctx + ", tx=" + tx); if(!ctx.isValid())