HHH-12811 Add @Target annotations to @CreationTimestamp and @UpdateTimestamp

This commit is contained in:
Guillaume Smet 2018-07-15 15:06:27 +02:00
parent 1688c3ff8d
commit e4ae86cce2
2 changed files with 12 additions and 2 deletions

View File

@ -6,10 +6,14 @@
*/ */
package org.hibernate.annotations; 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.Retention;
import java.lang.annotation.RetentionPolicy; 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 * 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) @ValueGenerationType(generatedBy = CreationTimestampGeneration.class)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ FIELD, METHOD })
public @interface CreationTimestamp { public @interface CreationTimestamp {
} }

View File

@ -6,10 +6,14 @@
*/ */
package org.hibernate.annotations; 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.Retention;
import java.lang.annotation.RetentionPolicy; 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 * 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) @ValueGenerationType(generatedBy = UpdateTimestampGeneration.class)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ FIELD, METHOD })
public @interface UpdateTimestamp { public @interface UpdateTimestamp {
} }