Top Description Methods
org.hibernate.annotations

public @Interface CurrentTimestamp

extends Annotation
Annotations
@ValueGenerationType
generatedBy:CurrentTimestampGeneration
@Retention:RUNTIME
@Target:FIELD, METHOD, ANNOTATION_TYPE
Imports
java.lang.annotation.Retention, .Target, org.hibernate.Remove, org.hibernate.generator.EventType, org.hibernate.generator.internal.CurrentTimestampGeneration, org.hibernate.tuple.GenerationTiming

Specifies that the annotated field of property is a generated timestamp, and also specifies the timing of the timestamp generation, and whether it is generated in Java or by the database:

By default, the timestamp is generated by the database, which requires an extra round trip to the database to fetch the generated value.

This annotation may be used in combination with the JPA-defined jakarta.persistence.Version annotation.

The annotated property may be of any one of the following types: java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time, java.sql.Timestamp, java.time.Instant, java.time.LocalDate, java.time.LocalDateTime, java.time.LocalTime, java.time.MonthDay, java.time.OffsetDateTime, java.time.OffsetTime, java.time.Year, java.time.YearMonth, or java.time.ZonedDateTime.

Author
Steve Ebersole
Since
6.0
See Also
UpdateTimestamp, CreationTimestamp, CurrentTimestampGeneration

Method Summary

Modifier and TypeMethod and Description
public EventType[]
event()

Determines when the timestamp is generated.

public SourceType
source()

Specifies how the timestamp is generated.

public @Remove GenerationTiming
timing()

Deprecated since 6.2. This was introduced in error
Determines when the timestamp is generated.
Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

eventback to summary
public EventType[] event()

Determines when the timestamp is generated. But default, it is updated when any SQL insert or update statement is executed. If it should be generated just once, on the initial SQL insert, explicitly specify event = INSERT.

sourceback to summary
public SourceType source()

Specifies how the timestamp is generated. By default, it is generated by the database, and fetched using a subsequent select statement.

timingback to summary
public @Remove GenerationTiming timing()

Deprecated

since 6.2.

This was introduced in error

Determines when the timestamp is generated. But default, it is updated when any SQL insert or update statement is executed. If it should be generated just once, on the initial SQL insert, explicitly specify timing = INSERT.

Annotations
@Deprecated
since:6.2
@Remove