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 { }