From 2353697a03be820d7102697df4611dd89dd7c186 Mon Sep 17 00:00:00 2001 From: Vlad Mihalcea Date: Thu, 22 Jun 2017 12:44:38 +0300 Subject: [PATCH] Add fetch as well for LocalDateTime test --- .../mapping/basic/LocalDateTimeWithTemporalTimeTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/LocalDateTimeWithTemporalTimeTest.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/LocalDateTimeWithTemporalTimeTest.java index 68bb84bb36..e4ad710ffc 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/LocalDateTimeWithTemporalTimeTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/LocalDateTimeWithTemporalTimeTest.java @@ -17,6 +17,7 @@ import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; +import static org.junit.Assert.assertNotNull; /** * @author Vlad Mihalcea @@ -34,15 +35,19 @@ public class LocalDateTimeWithTemporalTimeTest extends BaseEntityManagerFunction public void testLifecycle() { doInJPA( this::entityManagerFactory, entityManager -> { DateEvent dateEvent = new DateEvent( LocalDateTime.now() ); + dateEvent.id = 1L; entityManager.persist( dateEvent ); } ); + doInJPA( this::entityManagerFactory, entityManager -> { + DateEvent dateEvent = entityManager.find( DateEvent.class, 1L ); + assertNotNull(dateEvent.getTimestamp()); + } ); } @Entity(name = "DateEvent") public static class DateEvent { @Id - @GeneratedValue private Long id; //throws org.hibernate.AnnotationException: @Temporal should only be set on a java.util.Date or java.util.Calendar property