Last active
July 30, 2018 07:37
-
-
Save sirius2k/a18d8d716616dca52265e3fca0450d0d to your computer and use it in GitHub Desktop.
JPA Auditing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enable JPA Auditing in Configuration | |
@Configuration | |
@EnableTransactionManagement | |
@EnableJpaRepositories | |
@EnableJpaAuditing | |
public class PersistenceConfig { ... } | |
@Entity | |
@EntityListeners(AuditingEntityListener.class) | |
public class Bar { ... } | |
@Entity | |
@EntityListeners(AuditingEntityListener.class) | |
public class Bar { | |
//... | |
@Column(name = "created_date", nullable = false, updatable = false) | |
@CreatedDate | |
private long createdDate; | |
@Column(name = "modified_date") | |
@LastModifiedDate | |
private long modifiedDate; | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment