1

I used to use java.util.Calendar and java.util.Date, but now I´m facing a convert problem that I don't undestand. Every date that a work persists righ at the database but in the application miss 2 days.

My system uses Java8 Hibernate 5.2 MS SQL 2008

Database enter image description here

System.out enter image description here

System enter image description here

Actualy I'm using Calendar but it's the same problem with Date and LocalDate and LocaDateTime. There's any knwoing bug?

My Persistence

<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="GEREVD" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <class>kmsimplecode.model.Log</class> <properties> <property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServer2008Dialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://server;databaseName=database"/> <property name="javax.persistence.jdbc.user" value="sa"/> <property name="javax.persistence.jdbc.password" value="pass"/> <property name="hibernate.enable_lazy_load_no_trans" value="true"/> </properties> </persistence-unit> </persistence> 

1 Answer 1

2

Well there's nothing wrong in my code just the JDBC Edition to work with Java8

Date columns in SQL-Server (MSSQL-JDBC 3.0) running under Java 1.7.0 retrieved as 2 days in the past

https://www.microsoft.com/en-us/download/confirmation.aspx?id=11774

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.