Here’s the simple test case for an entity Flour:
{code:java} @Test public void test() { final Flour rose = new Flour( 2, "Rose", "made from ground rose pedals.", "Full fragrance" ); rose.setLocalTime( LocalTime.MAX );
try (Session ormSession = ormFactory.openSession()) { ormSession.beginTransaction(); ormSession.persist( rose ); ormSession.getTransaction().commit(); }
try (Session ormSession = ormFactory.openSession()) { Flour flour = ormSession.find( Flour.class, rose.id ); Assertions.assertThat( rose.localTime ).isEqualToIgnoringSeconds( flour.localTime ); } } {code}
{code:java} @Entity(name = "Flour") @Table(name = "Flour") public static class Flour { @Id private Integer id; private String name; private String description; private String type;
private LocalTime localTime; public Flour() { }
public Flour(Integer id, String name, String description, String type) { this.id = id; this.name = name; this.description = description; this.type = type; } ... }{code}
The error:
{noformat}Expecting actual: 23:59:59.999999999 to have same hour and minute as: 13:46:39 but had not. java.lang.AssertionError: Expecting actual: 23:59:59.999999999 to have same hour and minute as: 13:46:39 but had not. {noformat}
I’m using the following image:
{noformat}podman run --rm -it --name HibernateTestingMSSQL -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=~!HReact!~' -p 1433:1433 mcr.microsoft.com/mssql/server:2022-latest{noformat}
Note that it works with ORM 5.6.14.Final |
|