Hibernate JPA @Source Example

@Source

The @Source annotation is used in conjunction with a @Version timestamp entity attribute indicating the SourceType of the timestamp value.

The SourceType offers two options:

DB
Get the timestamp from the database.

VM
Get the timestamp from the current JVM.

Source optional annotation in conjunction with Version and timestamp version properties indicating the source of the timestamp value.

Database-generated version timestamp mapping

@Entity(name = "Person")
public static class Person {

@Id
private Long id;

private String firstName;

private String lastName;

@Version
@Source(value = SourceType.DB)
private Date version;


}

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept