Last active
August 29, 2019 18:21
-
-
Save thjanssen/c7c20b5d8d75b5b7db7862069f8801e6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Book b = new Book(); | |
b.setTitle(“The Hound of the Baskervilles”); | |
b.setPublishingDate(LocalDate.of(1902, 4, 30)); | |
em.persist(b); |
This file contains hidden or 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
@Entity | |
public class Book { | |
@Id | |
@GeneratedValue(generator = “UUID”) | |
@GenericGenerator( | |
name = “UUID”, | |
strategy = “org.hibernate.id.UUIDGenerator”, | |
parameters = { | |
@Parameter( | |
name = “uuid_gen_strategy_class”, | |
value = “org.hibernate.id.uuid.CustomVersionOneStrategy” | |
) | |
} | |
) | |
@Column(name = “id”, updatable = false, nullable = false) | |
private UUID id; | |
… | |
} |
This file contains hidden or 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
12:35:22,760 DEBUG AbstractSaveEventListener:118 – Generated identifier: c0a8b214-578f-131a-8157-8f431d060000, using strategy: org.hibernate.id.UUIDGenerator | |
12:35:22,792 DEBUG SQL:92 – insert into Book (publishingDate, title, version, id) values (?, ?, ?, ?) | |
12:35:22,795 TRACE BasicBinder:65 – binding parameter [1] as [DATE] – [1902-04-30] | |
12:35:22,795 TRACE BasicBinder:65 – binding parameter [2] as [VARCHAR] – [The Hound of the Baskervilles] | |
12:35:22,796 TRACE BasicBinder:65 – binding parameter [3] as [INTEGER] – [0] | |
12:35:22,797 TRACE BasicBinder:65 – binding parameter [4] as [OTHER] – [c0a8b214-578f-131a-8157-8f431d060000] |
This file contains hidden or 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
@Entity | |
public class Book { | |
@Id | |
@GeneratedValue(generator = “UUID”) | |
@GenericGenerator( | |
name = “UUID”, | |
strategy = “org.hibernate.id.UUIDGenerator”, | |
) | |
@Column(name = “id”, updatable = false, nullable = false) | |
private UUID id; | |
… | |
} |
This file contains hidden or 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
12:23:19,356 DEBUG AbstractSaveEventListener:118 – Generated identifier: d7cd23b8-991c-470f-ac63-d8fb106f391e, using strategy: org.hibernate.id.UUIDGenerator | |
12:23:19,388 DEBUG SQL:92 – insert into Book (publishingDate, title, version, id) values (?, ?, ?, ?) | |
12:23:19,392 TRACE BasicBinder:65 – binding parameter [1] as [DATE] – [1902-04-30] | |
12:23:19,393 TRACE BasicBinder:65 – binding parameter [2] as [VARCHAR] – [The Hound of the Baskervilles] | |
12:23:19,393 TRACE BasicBinder:65 – binding parameter [3] as [INTEGER] – [0] | |
12:23:19,394 TRACE BasicBinder:65 – binding parameter [4] as [OTHER] – [d7cd23b8-991c-470f-ac63-d8fb106f391e] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment