Here are the examples of the java api org.grails.datastore.gorm.events.AutoTimestampEventListener.DATE_CREATED_PROPERTY taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
15
View Complete Implementation : ClosureEventTriggeringInterceptor.java
Copyright Apache License 2.0
Author : grails
Copyright Apache License 2.0
Author : grails
private void updateModifiedPropertiesWithAutoTimestamp(Map<String, Object> modifiedProperties, PreUpdateEvent hibernateEvent) {
EnreplacedyMetamodel enreplacedyMetamodel = hibernateEvent.getPersister().getEnreplacedyMetamodel();
Integer dateCreatedIdx = enreplacedyMetamodel.getPropertyIndexOrNull(AutoTimestampEventListener.DATE_CREATED_PROPERTY);
Object[] oldState = hibernateEvent.getOldState();
Object[] state = hibernateEvent.getState();
// Only for "dateCreated" property, "lastUpdated" is handled correctly
if (dateCreatedIdx != null && oldState != null && oldState[dateCreatedIdx] != null && !oldState[dateCreatedIdx].equals(state[dateCreatedIdx])) {
modifiedProperties.put(AutoTimestampEventListener.DATE_CREATED_PROPERTY, oldState[dateCreatedIdx]);
}
}