Add fetch as well for LocalDateTime test
This commit is contained in:
parent
385f6d056c
commit
2353697a03
|
@ -17,6 +17,7 @@ import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
|
@ -34,15 +35,19 @@ public class LocalDateTimeWithTemporalTimeTest extends BaseEntityManagerFunction
|
||||||
public void testLifecycle() {
|
public void testLifecycle() {
|
||||||
doInJPA( this::entityManagerFactory, entityManager -> {
|
doInJPA( this::entityManagerFactory, entityManager -> {
|
||||||
DateEvent dateEvent = new DateEvent( LocalDateTime.now() );
|
DateEvent dateEvent = new DateEvent( LocalDateTime.now() );
|
||||||
|
dateEvent.id = 1L;
|
||||||
entityManager.persist( dateEvent );
|
entityManager.persist( dateEvent );
|
||||||
} );
|
} );
|
||||||
|
doInJPA( this::entityManagerFactory, entityManager -> {
|
||||||
|
DateEvent dateEvent = entityManager.find( DateEvent.class, 1L );
|
||||||
|
assertNotNull(dateEvent.getTimestamp());
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "DateEvent")
|
@Entity(name = "DateEvent")
|
||||||
public static class DateEvent {
|
public static class DateEvent {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
//throws org.hibernate.AnnotationException: @Temporal should only be set on a java.util.Date or java.util.Calendar property
|
//throws org.hibernate.AnnotationException: @Temporal should only be set on a java.util.Date or java.util.Calendar property
|
||||||
|
|
Loading…
Reference in New Issue