public void clearRelationships() { _relationships = null; clearAllDirectRefs(); }
public void copyNonPkAttributes(MithraDataObject newData) { final PetData petData = (PetData) newData; this.setPersonId(petData.getPersonId()); this.setPetAge(petData.getPetAge()); this.setPetTypeId(petData.getPetTypeId()); this.setProcessingDateFrom(petData.getProcessingDateFrom()); this.setProcessingDateTo(petData.getProcessingDateTo()); }
public boolean zNonPrimaryKeyAttributesChanged(MithraDataObject newData, double toleranceForFloatingPointFields) { final PetData other = (PetData) newData; if ( getPersonId() != other.getPersonId()) { return true; } if ( getPetAge() != other.getPetAge()) { return true; } if ( getPetTypeId() != other.getPetTypeId()) { return true; } return false; }
if(data.isPetNameNull()) stm.setString(pos++, data.getPetName()); stm.setInt(pos++, data.getPersonId()); stm.setInt(pos++, data.getPetAge()); stm.setInt(pos++, data.getPetTypeId()); if(data.isProcessingDateFromNull()) dt.setTimestamp(stm, pos, data.getProcessingDateFrom(), false, conversionTimeZone); pos++; if(data.isProcessingDateToNull()) if (data.getProcessingDateTo().getTime() == PetFinder.processingDate().getInfinityDate().getTime()) dt.setTimestamp(stm, pos, data.getProcessingDateTo(), false, conversionTimeZone); pos++;
public String zGetPrintablePrimaryKey() { String result = ""; result += "petName: "+"'"+getPetName()+"'"+ " / "; result += "processingDateFrom: "+(isProcessingDateFromNull() ? "null" : PrintablePreparedStatement.timestampFormat.print(zGetProcessingDateFromAsLong()))+ " / "; result += "processingDateTo: "+(isProcessingDateToNull() ? "null" : PrintablePreparedStatement.timestampFormat.print(zGetProcessingDateToAsLong()))+ " / "; return result; }
if (_related == null) _op = PersonFinder.personId().eq(_data.getPersonId()); if (_data.getOwner() instanceof NulledRelation) _result = (Person) _data.getOwner(); if (_result == null) Operation detachedOp = PersonFinder.personId().eq(_data.getPersonId()); _result = PersonFinder.zFindOneForRelationship(detachedOp); if(_result != null) _data.setOwner(_result); _result = (Person) _data.getOwner(); if (_result == null) _op = PersonFinder.personId().eq(_data.getPersonId());
public boolean hasSamePrimaryKeyIgnoringAsOfAttributes(MithraDataObject other) { if (this == other) return true; final PetData otherData = (PetData) other; if (!isPetNameNull() ? !getPetName().equals(otherData.getPetName()) : !otherData.isPetNameNull()) { return false; } return true; }
public PetData inflatePetPkData(ResultSet _rs, DatabaseType _dt) throws SQLException { PetData _data = new PetData(); int _pos = 1; _data.setPetName(trimString(_rs.getString(_pos++))); return _data; }
public boolean isPetNameNull() { return this.getPetName() == null; }
public int setPrimaryKeyAttributesWithoutOptimistic(PreparedStatement stm, int pos, MithraDataObject dataObj, TimeZone databaseTimeZone, DatabaseType dt) throws SQLException { PetData data = (PetData)dataObj; TimeZone conversionTimeZone = null; stm.setString(pos++, data.getPetName()); conversionTimeZone = MithraTimestamp.DefaultTimeZone; if (data.getProcessingDateTo().getTime() == PetFinder.processingDate().getInfinityDate().getTime()) { conversionTimeZone = MithraTimestamp.DefaultTimeZone; } dt.setTimestamp(stm, pos, data.getProcessingDateTo(), false, conversionTimeZone); pos++; return pos; }
protected void zCheckOptimisticLocking(MithraTransaction tx, MithraDataObject d, MithraDataObject nd) { PetData newData = (PetData) d; PetData data = (PetData) nd; if (PetFinder.getMithraObjectPortal().getTxParticipationMode(tx).isOptimisticLocking() && !tx.retryOnOptimisticLockFailure() && !newData.getProcessingDateFrom().equals(data.getProcessingDateFrom())) { throw new MithraOptimisticLockException("Optimistic lock failure. "+data.zGetPrintablePrimaryKey()); } }
public MithraObject deserializeForRefresh(ObjectInput in) throws IOException, ClassNotFoundException { PetData data = new PetData(); data.zDeserializePrimaryKey(in); Timestamp[] asof = new Timestamp[1]; asof[0] = TimestampPool.getInstance().getOrAddToCache(MithraTimestamp.readTimezoneInsensitiveTimestampWithInfinity(in, kata.util.TimestampProvider.getInfinityDate()), PetFinder.isFullCache()); return this.createObject(data, asof); }
if (_related == null) _op = PetTypeFinder.petTypeId().eq(_data.getPetTypeId()); Operation detachedOp = PetTypeFinder.petTypeId().eq(_data.getPetTypeId()); _result = PetTypeFinder.zFindOneForRelationship(detachedOp); _result = (PetType) _data.getPetType(); if (_result == null) _op = PetTypeFinder.petTypeId().eq(_data.getPetTypeId());
public void setOwner(Person owner) { Person _owner = (Person) owner; DatedTransactionalBehavior _behavior = zGetTransactionalBehaviorForWrite(); PetData _data = (PetData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { Object _prev = _data.getOwner(); if (_behavior.isDetached() && _prev != null) { ((DelegatingList)((Person)_prev).getPets()).zMarkMoved( (Pet) this); } _data.setOwner(_owner); _owner.getPets().add((Pet) this); } else if (_behavior.isPersisted()) { if (_owner == null) { this.setPersonId(0); } else { this.setPersonId( _owner.getPersonId()); } } else throw new RuntimeException("not implemented"); }
public static PetData allocateOnHeapData() { return new PetData(); }
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData) { PetData _castedSrcData = (PetData) _srcData; return HashUtil.hash(_castedSrcData.getPersonId()); }
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData) { PetData _castedSrcData = (PetData) _srcData; return HashUtil.hash(_castedSrcData.getPetTypeId()); }
public boolean isProcessingDateFromNull() { return this.getProcessingDateFrom() == null; }
public int getPetAge() { return this.zSynchronizedGetData().getPetAge(); }