From e4ae86cce27808a0ae5ed942d16d8adc069414a3 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Sun, 15 Jul 2018 15:06:27 +0200 Subject: [PATCH] HHH-12811 Add @Target annotations to @CreationTimestamp and @UpdateTimestamp --- .../java/org/hibernate/annotations/CreationTimestamp.java | 7 ++++++- .../java/org/hibernate/annotations/UpdateTimestamp.java | 7 ++++++- 2 files changed, 12 insertions(+), 2 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 9b5405f1de..b780103ee0 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/CreationTimestamp.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/CreationTimestamp.java @@ -6,10 +6,14 @@ */ package org.hibernate.annotations; -import org.hibernate.tuple.CreationTimestampGeneration; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.hibernate.tuple.CreationTimestampGeneration; /** * Marks a property as the creation timestamp of the containing entity. The property value will be set to the current @@ -38,5 +42,6 @@ import java.lang.annotation.RetentionPolicy; */ @ValueGenerationType(generatedBy = CreationTimestampGeneration.class) @Retention(RetentionPolicy.RUNTIME) +@Target({ FIELD, METHOD }) public @interface CreationTimestamp { } 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 c1635886da..7e442f9e1c 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/UpdateTimestamp.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/UpdateTimestamp.java @@ -6,10 +6,14 @@ */ package org.hibernate.annotations; -import org.hibernate.tuple.UpdateTimestampGeneration; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.hibernate.tuple.UpdateTimestampGeneration; /** * Marks a property as the update timestamp of the containing entity. The property value will be set to the current VM @@ -38,5 +42,6 @@ import java.lang.annotation.RetentionPolicy; */ @ValueGenerationType(generatedBy = UpdateTimestampGeneration.class) @Retention(RetentionPolicy.RUNTIME) +@Target({ FIELD, METHOD }) public @interface UpdateTimestamp { }