Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,13 @@ protected Set<String> getDateCreatedPropertyNames(String entityName) {
return properties == null ? null : properties.orElse(null);
}

private static Field getFieldFromHierarchy(PersistentEntity persistentEntity, String fieldName) {
Class<?> clazz = persistentEntity.getJavaClass();
private static Field getFieldFromHierarchy(Class<?> entity, String fieldName) {
Class<?> clazz = entity;
while (clazz != null) {
try {
return clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
persistentEntity = persistentEntity.getParentEntity();
clazz = persistentEntity == null? null : persistentEntity.getJavaClass();
clazz = clazz.getSuperclass();
}
}
return null;
Expand All @@ -179,7 +178,7 @@ protected void storeDateCreatedAndLastUpdatedInfo(PersistentEntity persistentEnt
} else if (property.getName().equals(DATE_CREATED_PROPERTY)) {
storeTimestampAvailability(entitiesWithDateCreated, persistentEntity, property);
} else {
Field field = getFieldFromHierarchy(persistentEntity, property.getName());
Field field = getFieldFromHierarchy(persistentEntity.getJavaClass(), property.getName());
if (field != null && field.isAnnotationPresent(AutoTimestamp.class)) {
AutoTimestamp autoTimestamp = field.getAnnotation(AutoTimestamp.class);
if (autoTimestamp.value() == AutoTimestamp.EventType.UPDATED) {
Expand Down
Loading