use of jakarta.persistence.PostLoad in project hibernate-orm by hibernate.
the class Cat method calculateAge.
@PostLoad
public void calculateAge() {
Calendar birth = new GregorianCalendar();
birth.setTime(dateOfBirth);
Calendar now = new GregorianCalendar();
now.setTime(new Date());
int adjust = 0;
if (now.get(Calendar.DAY_OF_YEAR) - birth.get(Calendar.DAY_OF_YEAR) < 0) {
adjust = -1;
}
age = now.get(Calendar.YEAR) - birth.get(Calendar.YEAR) + adjust;
}
use of jakarta.persistence.PostLoad in project wildfly by wildfly.
the class Cat method calculateAge.
@PostLoad
public void calculateAge() {
Calendar birth = new GregorianCalendar();
birth.setTime(dateOfBirth);
Calendar now = new GregorianCalendar();
now.setTime(new Date());
int adjust = 0;
if (now.get(Calendar.DAY_OF_YEAR) - birth.get(Calendar.DAY_OF_YEAR) < 0) {
adjust = -1;
}
age = now.get(Calendar.YEAR) - birth.get(Calendar.YEAR) + adjust;
}
use of jakarta.persistence.PostLoad in project tessera by ConsenSys.
the class StagingTransactionListener method onLoad.
@PostLoad
public void onLoad(StagingTransaction stagingTransaction) {
LOGGER.debug("onLoad[{}]", stagingTransaction);
final EncodedPayloadCodec encodedPayloadCodec = stagingTransaction.getEncodedPayloadCodec();
final byte[] encodedPayloadData = stagingTransaction.getPayload();
final PayloadEncoder payloadEncoder = PayloadEncoder.create(encodedPayloadCodec);
final EncodedPayload encodedPayload = payloadEncoder.decode(encodedPayloadData);
stagingTransaction.setEncodedPayload(encodedPayload);
}
use of jakarta.persistence.PostLoad in project tessera by ConsenSys.
the class EncryptedTransactionListener method onLoad.
@PostLoad
public void onLoad(EncryptedTransaction encryptedTransaction) {
LOGGER.debug("onLoad[{}]", encryptedTransaction);
final EncodedPayloadCodec encodedPayloadCodec = Optional.ofNullable(encryptedTransaction.getEncodedPayloadCodec()).orElse(EncodedPayloadCodec.LEGACY);
final byte[] encodedPayloadData = encryptedTransaction.getEncodedPayload();
final PayloadEncoder payloadEncoder = PayloadEncoder.create(encodedPayloadCodec);
final EncodedPayload encodedPayload = payloadEncoder.decode(encodedPayloadData);
encryptedTransaction.setPayload(encodedPayload);
encryptedTransaction.setEncodedPayloadCodec(encodedPayloadCodec);
}
Aggregations