Skip to content

Instantly share code, notes, and snippets.

@thjanssen
Created December 14, 2016 18:13
Show Gist options
  • Save thjanssen/5eda2206a728ecaf39e26f18c9ee3f94 to your computer and use it in GitHub Desktop.
Save thjanssen/5eda2206a728ecaf39e26f18c9ee3f94 to your computer and use it in GitHub Desktop.
@Entity
public class Author {
@PrePersist
private void initializeCreatedAt() {
this.createdAt = LocalDateTime.now();
log.info(“Set createdAt to “+this.createdAt);
}
}
14:31:14,871 INFO [org.thoughts.on.java.model.Author] – Set createdAt to 2016-12-14T14:31:14.868
14:31:14,878 DEBUG [org.hibernate.SQL] – select nextval (‘hibernate_sequence’)
14:31:14,920 DEBUG [org.hibernate.SQL] – insert into Author (createdAt, firstName, lastName, version, id) values (?, ?, ?, ?, ?)
14:31:14,923 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] – binding parameter [1] as [TIMESTAMP] – [2016-12-14T14:31:14.868]
14:31:14,924 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] – binding parameter [2] as [VARCHAR] – [first name]
14:31:14,924 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] – binding parameter [3] as [VARCHAR] – [last name]
14:31:14,925 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] – binding parameter [4] as [INTEGER] – [0]
14:31:14,926 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] – binding parameter [5] as [BIGINT] – [1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment