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