@PostUpdate private void someLateUpdateWorking() { log.debug( "PostUpdate for: " + this.toString() ); postVersion++; }
/** * Invoked on both the PostPersist and PostUpdate. The default implementation is to simply publish a Spring event * to the ApplicationContext after the transaction has completed. * * @param entity the newly-persisted Customer * @see CustomerPersistedEvent */ @PostPersist @PostUpdate public void customerUpdated(final Object entity) { if (TransactionSynchronizationManager.isSynchronizationActive()) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { ApplicationContextHolder.getApplicationContext().publishEvent(new CustomerPersistedEvent((Customer) entity)); } }); } }
/** * Invoked on both the PostPersist and PostUpdate. The default implementation is to simply publish a Spring event * to the ApplicationContext to allow an event listener to respond appropriately (like resetting the current cart * in CartState) * * @param entity the newly-persisted Order * @see OrderPersistedEvent */ @PostPersist @PostUpdate public void orderUpdated(final Object entity) { if (TransactionSynchronizationManager.isSynchronizationActive()) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { if (status == TransactionSynchronization.STATUS_COMMITTED) { ApplicationContextHolder.getApplicationContext().publishEvent(new OrderPersistedEvent((Order) entity)); } } }); } }
/** * Invoked on PostPersist, PostUpdate, and PostRemove. The default implementation is to simply publish a Spring event * to the ApplicationContext after the transaction has completed. * * @param entity the newly-persisted CustomerPhone * @see CustomerPersistedEvent */ @PostPersist @PostUpdate @PostRemove public void customerPhoneUpdated(final Object entity) { if (TransactionSynchronizationManager.isSynchronizationActive()) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { ApplicationContextHolder.getApplicationContext().publishEvent(new CustomerPersistedEvent(((CustomerPhone) entity).getCustomer())); } }); } } }
/** * Invoked on PostPersist, PostUpdate, and PostRemove. The default implementation is to simply publish a Spring event * to the ApplicationContext after the transaction has completed. * * @param entity the newly-persisted CustomerPayment * @see CustomerPersistedEvent */ @PostPersist @PostUpdate @PostRemove public void customerPaymentUpdated(final Object entity) { if (TransactionSynchronizationManager.isSynchronizationActive()) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { ApplicationContextHolder.getApplicationContext().publishEvent(new CustomerPersistedEvent(((CustomerPayment) entity).getCustomer())); } }); } } }
/** * Invoked on PostPersist, PostUpdate, and PostRemove. The default implementation is to simply publish a Spring event * to the ApplicationContext after the transaction has completed. * * @param entity the newly-persisted CustomerAddress * @see CustomerPersistedEvent */ @PostPersist @PostUpdate @PostRemove public void customerAddressUpdated(final Object entity) { if (TransactionSynchronizationManager.isSynchronizationActive()) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { ApplicationContextHolder.getApplicationContext().publishEvent(new CustomerPersistedEvent(((CustomerAddress) entity).getCustomer())); } }); } } }
@PostUpdate public void postUpdateEntityCOunter() { this.invocationCounter++; }
@PostUpdate void onPostUpdate(Object o) { getDataBaseFacade().entityEvent(EntityEvent.POST_UPDATE, o); }
@PostLoad @PostPersist @PostUpdate public void decodePrincipal() { if (StringUtils.isNotBlank(encodedPrincipal)) { this.principal = AuthenticatedPrincipal.deserialize(encodedPrincipal); } }
@PostLoad @PostPersist @PostUpdate public void decodePrincipal() { if (StringUtils.isNotBlank(encodedPrincipal)) { this.principal = AuthenticatedPrincipal.deserialize(encodedPrincipal); } }
/** * Default implementation of the JPA {@link PostUpdate} hook. This implementation currently does nothing, * however sub-classes can override and implement this method if needed. * * <p>This method is currently invoked by the corresponding OJB {@link #afterUpdate(PersistenceBroker)} hook. */ @PostUpdate protected void postUpdate() { // do nothing }
/** * Change the saved GUID after save. * When load saved GUID and GUID differ as GUID is update * on load. */ @PostPersist @PostUpdate public void updateSavedGuid() { savedGuid = UUID.randomUUID().toString(); }
@PostUpdate @PostPersist protected void clearIncludedCache() { includedCache.clear(); }
@PostUpdate public void onPostUpdate(Object entity) { DataMergeContext.addLoadedEntity(entity); } }
/** * Change the saved GUID after save. * When load saved GUID and GUID differ as GUID is update * on load. */ @PostPersist @PostUpdate public void updateSavedGuid() { savedGuid = UUID.randomUUID().toString(); }
@PostLoad @PostUpdate @PostPersist private void postLoadAttributes() { if (dbAttributes != null) { attributes = dbAttributes.values().stream().collect(toMap(attr -> attr.name, attr -> attr.values)); } }
@PostLoad @PostPersist @PostUpdate public void computeOrderReference(){ SimpleDateFormat sdf = new SimpleDateFormat("MMddyyyy"); reference = sdf.format(creationDate)+ORDER_REF_SEPARATOR+id; if (transactionId != null){ reference += ORDER_REF_SEPARATOR +transactionId; } }
@PostLoad @PostPersist @PostUpdate private void fillTransient() { if (quantity==null) { available = false; return; } if (threshold == null) threshold = 0; available = quantity >threshold; }
@PostUpdate public void onPostUpdate(Object entity) { if (handleExclude(entity)) return; DataContext.addUpdate(EntityUpdateType.UPDATE, entity, entity); }
/** * The entity life-cycle method. */ @PostPersist @PostLoad @PostUpdate public void checkPersistentState() { this.persisted = true; }