org.hibernate.annotations.CreationTimestamp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beangle-hibernate-core Show documentation
Show all versions of beangle-hibernate-core Show documentation
Hibernate Orm Core Shade,Support Scala Collection
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
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.Target;
import org.hibernate.generator.internal.CurrentTimestampGeneration;
/**
* Specifies that the annotated field of property is a generated creation timestamp.
* The timestamp is generated just once, when an entity instance is inserted in the database.
*
* By default, the timestamp is generated by {@linkplain java.time.Clock#instant() in memory},
* but this may be changed by explicitly specifying the {@link #source}.
* Otherwise, this annotation is a synonym for
* {@link CurrentTimestamp @CurrentTimestamp(timing=INSERT,source=VM)}.
*
* @author Gunnar Morling
*
* @see CurrentTimestamp
*/
@ValueGenerationType(generatedBy = CurrentTimestampGeneration.class)
@Retention(RUNTIME)
@Target({ FIELD, METHOD })
public @interface CreationTimestamp {
/**
* Specifies how the timestamp is generated. By default, it is generated
* in memory, which saves a round trip to the database.
*/
SourceType source() default SourceType.VM;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy