From e908d4c8f69ded8afe0cff683c3403965551313b Mon Sep 17 00:00:00 2001 From: Gavin Date: Mon, 28 Nov 2022 19:22:56 +0100 Subject: [PATCH] @CreationTimestamp should not be declared @Inherited --- .../hibernate/annotations/CreationTimestamp.java | 4 ++-- .../org/hibernate/annotations/CurrentTimestamp.java | 13 +++++++------ .../org/hibernate/annotations/UpdateTimestamp.java | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/CreationTimestamp.java b/hibernate-core/src/main/java/org/hibernate/annotations/CreationTimestamp.java index 6d5c336b7c..8fca7be0ac 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/CreationTimestamp.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/CreationTimestamp.java @@ -8,9 +8,9 @@ package org.hibernate.annotations; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.tuple.CreationTimestampGeneration; @@ -29,7 +29,7 @@ import org.hibernate.tuple.CreationTimestampGeneration; * @see CurrentTimestamp */ @ValueGenerationType(generatedBy = CreationTimestampGeneration.class) -@Retention(RetentionPolicy.RUNTIME) +@Retention(RUNTIME) @Target({ FIELD, METHOD }) public @interface CreationTimestamp { /** diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/CurrentTimestamp.java b/hibernate-core/src/main/java/org/hibernate/annotations/CurrentTimestamp.java index ecb3b3c00b..49613fda09 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/CurrentTimestamp.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/CurrentTimestamp.java @@ -6,14 +6,16 @@ */ package org.hibernate.annotations; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.tuple.GenerationTiming; +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + /** * Specifies that the annotated field of property is a generated timestamp, * and also specifies the {@linkplain #timing() timing} of the timestamp @@ -56,9 +58,8 @@ import org.hibernate.tuple.GenerationTiming; * @see CreationTimestamp */ @ValueGenerationType(generatedBy = CurrentTimestampGeneration.class) -@Retention(RetentionPolicy.RUNTIME) -@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE } ) -@Inherited +@Retention(RUNTIME) +@Target({ FIELD, METHOD, ANNOTATION_TYPE }) public @interface CurrentTimestamp { /** * Determines when the timestamp is generated. But default, it is updated diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/UpdateTimestamp.java b/hibernate-core/src/main/java/org/hibernate/annotations/UpdateTimestamp.java index da09ebdd67..b746a19c96 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/UpdateTimestamp.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/UpdateTimestamp.java @@ -8,9 +8,9 @@ package org.hibernate.annotations; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.tuple.UpdateTimestampGeneration; @@ -29,7 +29,7 @@ import org.hibernate.tuple.UpdateTimestampGeneration; * @author Gunnar Morling */ @ValueGenerationType(generatedBy = UpdateTimestampGeneration.class) -@Retention(RetentionPolicy.RUNTIME) +@Retention(RUNTIME) @Target({ FIELD, METHOD }) public @interface UpdateTimestamp { /**