title: Hibernate:Could not read entity state from ResultSet and IllegalArgumentException:GregorianCalendar.computeTime
body: <p>I'm beginner in JPA and hibernate and I'm just trying to fetch some data from my DB via hibernate but I failed and I got this error :</p>
  <pre><code>Apr 29, 2019 5:14:28 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
  INFO: HHH000204: Processing qPersistenceUnitInfo [name: NewPersistenceUnit]
  Apr 29, 2019 5:14:29 AM org.hibernate.Version logVersion
  INFO: HHH000412: Hibernate Core {5.4.2.Final}
  Apr 29, 2019 5:14:29 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;
  INFO: HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
  Apr 29, 2019 5:14:30 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
  WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
  Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
  Apr 29, 2019 5:14:30 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
  INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/shopping]
  Apr 29, 2019 5:14:30 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
  INFO: HHH10001001: Connection properties: {user=root, password=****}
  Apr 29, 2019 5:14:30 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
  INFO: HHH10001003: Autocommit mode: false
  Apr 29, 2019 5:14:30 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections &lt;init&gt;
  INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
  Apr 29, 2019 5:14:32 AM org.hibernate.dialect.Dialect &lt;init&gt;
  INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
  Apr 29, 2019 5:14:33 AM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
  INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@35e478f] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
  Apr 29, 2019 5:14:33 AM org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator initiateService
  INFO: HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
  Hibernate: 
      select
          itemclass0_.id as id1_0_0_,
          itemclass0_.author as author2_0_0_,
          itemclass0_.available_amount as availabl3_0_0_,
          itemclass0_.bought as bought4_0_0_,
          itemclass0_.imageURL as imageURL5_0_0_,
          itemclass0_.name as name6_0_0_,
          itemclass0_.price as price7_0_0_,
          itemclass0_.publish_time as publish_8_0_0_ 
      from
          item itemclass0_ 
      where
          itemclass0_.id=?
  Apr 29, 2019 5:14:33 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  WARN: SQL Error: 0, SQLState: S1009
  Apr 29, 2019 5:14:33 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  ERROR: MONTH
  Apr 29, 2019 5:14:33 AM org.hibernate.event.internal.DefaultLoadEventListener doOnLoad
  INFO: HHH000327: Error performing load command : org.hibernate.exception.GenericJDBCException: Could not read entity state from ResultSet : EntityKey[entities.ItemClass#58]
  Exception in thread &quot;main&quot; javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not read entity state from ResultSet : EntityKey[entities.ItemClass#58]
      at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
      at org.hibernate.internal.SessionImpl.find(SessionImpl.java:3581)
      at org.hibernate.internal.SessionImpl.find(SessionImpl.java:3519)
      at Test.main(Test.java:17)
  Caused by: org.hibernate.exception.GenericJDBCException: Could not read entity state from ResultSet : EntityKey[entities.ItemClass#58]
      at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
      at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.loadFromResultSet(EntityReferenceInitializerImpl.java:320)
      at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.hydrateEntityState(EntityReferenceInitializerImpl.java:233)
      at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.readRow(AbstractRowReader.java:103)
      at org.hibernate.loader.plan.exec.internal.EntityLoadQueryDetails$EntityLoaderRowReader.readRow(EntityLoadQueryDetails.java:254)
      at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:122)
      at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:122)
      at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:86)
      at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:197)
      at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4279)
      at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:482)
      at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:452)
      at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:203)
      at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:262)
      at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:105)
      at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:73)
      at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1287)
      at org.hibernate.internal.SessionImpl.access$2100(SessionImpl.java:212)
      at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.doLoad(SessionImpl.java:2930)
      at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.lambda$load$1(SessionImpl.java:2911)
      at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.perform(SessionImpl.java:2867)
      at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2911)
      at org.hibernate.internal.SessionImpl.find(SessionImpl.java:3552)
      ... 2 more
  Caused by: java.sql.SQLException: MONTH
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
      at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:85)
      at com.mysql.cj.jdbc.result.ResultSetImpl.getDate(ResultSetImpl.java:847)
      at com.mysql.cj.jdbc.result.ResultSetImpl.getDate(ResultSetImpl.java:860)
      at org.hibernate.type.descriptor.sql.DateTypeDescriptor$2.doExtract(DateTypeDescriptor.java:76)
      at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:243)
      at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:329)
      at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:3014)
      at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.loadFromResultSet(EntityReferenceInitializerImpl.java:305)
      ... 23 more
  Caused by: com.mysql.cj.exceptions.WrongArgumentException: MONTH
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
      at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
      at com.mysql.cj.result.SqlDateValueFactory.createFromDate(SqlDateValueFactory.java:80)
      at com.mysql.cj.result.SqlDateValueFactory.createFromDate(SqlDateValueFactory.java:46)
      at com.mysql.cj.result.BaseDecoratingValueFactory.createFromDate(BaseDecoratingValueFactory.java:53)
      at com.mysql.cj.result.BaseDecoratingValueFactory.createFromDate(BaseDecoratingValueFactory.java:53)
      at com.mysql.cj.protocol.a.MysqlTextValueDecoder.decodeDate(MysqlTextValueDecoder.java:72)
      at com.mysql.cj.protocol.result.AbstractResultsetRow.decodeAndCreateReturnValue(AbstractResultsetRow.java:90)
      at com.mysql.cj.protocol.result.AbstractResultsetRow.getValueFromBytes(AbstractResultsetRow.java:250)
      at com.mysql.cj.protocol.a.result.ByteArrayRow.getValue(ByteArrayRow.java:91)
      at com.mysql.cj.jdbc.result.ResultSetImpl.getNonStringValueFromRow(ResultSetImpl.java:656)
      at com.mysql.cj.jdbc.result.ResultSetImpl.getDateOrTimestampValueFromRow(ResultSetImpl.java:679)
      ... 33 more
  Caused by: java.lang.IllegalArgumentException: MONTH
      at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2648)
      at java.util.Calendar.updateTime(Calendar.java:3393)
      at java.util.Calendar.getTimeInMillis(Calendar.java:1782)
      at com.mysql.cj.result.SqlDateValueFactory.createFromDate(SqlDateValueFactory.java:77)
      ... 42 more
  
  Process finished with exit code 1
  </code></pre>
  <p>and Also type of publish_time column is date.</p>
  <p><strong>Persistence.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;persistence xmlns=&quot;http://java.sun.com/xml/ns/persistence&quot; version=&quot;2.0&quot;&gt;
  
      &lt;persistence-unit name=&quot;NewPersistenceUnit&quot;&gt;
          &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
          &lt;class&gt;entities.ItemClass&lt;/class&gt;
          &lt;properties&gt;
              &lt;property name=&quot;hibernate.connection.url&quot; value=&quot;jdbc:mysql://localhost:3306/shopping&quot;/&gt;
              &lt;property name=&quot;hibernate.connection.driver_class&quot; value=&quot;com.mysql.jdbc.Driver&quot;/&gt;
              &lt;property name=&quot;hibernate.connection.username&quot; value=&quot;root&quot;/&gt;
              &lt;property name=&quot;hibernate.connection.password&quot; value=&quot;****&quot;/&gt;
              &lt;property name=&quot;hibernate.archive.autodetection&quot; value=&quot;class&quot;/&gt;
              &lt;property name=&quot;hibernate.show_sql&quot; value=&quot;true&quot;/&gt;
              &lt;property name=&quot;hibernate.format_sql&quot; value=&quot;true&quot;/&gt;
              &lt;property name=&quot;hibernate.hbm2ddl.auto&quot; value=&quot;update&quot;/&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  <p><strong>This is my Entity Class</strong></p>
  <p><strong>ItemClass.java</strong></p>
  <pre><code>package entities;
  
  import javax.persistence.*;
  import java.sql.Date;
  import java.util.Objects;
  
  @Entity
  @Table(name = &quot;item&quot;, schema = &quot;shopping&quot;, catalog = &quot;&quot;)
  public class ItemClass {
      private int id;
      private String name;
      private Integer price;
      private String imageUrl;
      private Integer availableAmount;
      private Integer bought;
  
      @Temporal(TemporalType.TIMESTAMP)
      private Date publishTime;
  
      private String author;
  
      @Id
      @Column(name = &quot;id&quot;, nullable = false)
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      @Basic
      @Column(name = &quot;name&quot;, nullable = false, length = 45)
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      @Basic
      @Column(name = &quot;price&quot;, nullable = true)
      public Integer getPrice() {
          return price;
      }
  
      public void setPrice(Integer price) {
          this.price = price;
      }
  
      @Basic
      @Column(name = &quot;imageURL&quot;, nullable = true, length = 45)
      public String getImageUrl() {
          return imageUrl;
      }
  
      public void setImageUrl(String imageUrl) {
          this.imageUrl = imageUrl;
      }
  
      @Basic
      @Column(name = &quot;available_amount&quot;, nullable = true)
      public Integer getAvailableAmount() {
          return availableAmount;
      }
  
      public void setAvailableAmount(Integer availableAmount) {
          this.availableAmount = availableAmount;
      }
  
      @Basic
      @Column(name = &quot;bought&quot;, nullable = true)
      public Integer getBought() {
          return bought;
      }
  
      public void setBought(Integer bought) {
          this.bought = bought;
      }
  
      @Basic
      @Column(name = &quot;publish_time&quot;, nullable = true)
      public Date getPublishTime() {
          return publishTime;
      }
  
      public void setPublishTime(Date publishTime) {
          this.publishTime = publishTime;
      }
  
      @Basic
      @Column(name = &quot;author&quot;, nullable = false, length = 45)
      public String getAuthor() {
          return author;
      }
  
      public void setAuthor(String author) {
          this.author = author;
      }
  
      @Override
      public boolean equals(Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          ItemClass itemClass = (ItemClass) o;
          return id == itemClass.id &amp;&amp;
                  Objects.equals(name, itemClass.name) &amp;&amp;
                  Objects.equals(price, itemClass.price) &amp;&amp;
                  Objects.equals(imageUrl, itemClass.imageUrl) &amp;&amp;
                  Objects.equals(availableAmount, itemClass.availableAmount) &amp;&amp;
                  Objects.equals(bought, itemClass.bought) &amp;&amp;
                  Objects.equals(publishTime, itemClass.publishTime) &amp;&amp;
                  Objects.equals(author, itemClass.author);
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(id, name, price, imageUrl, availableAmount, bought, publishTime, author);
      }
  }
  </code></pre>
  <p><strong>Test.java</strong></p>
  <pre><code>import entities.ItemClass;
  
  
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  
  
  public class Test {
  
      public static void main(String[] args) {
  
          EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(&quot;NewPersistenceUnit&quot;);
  
          EntityManager entityManager = entityManagerFactory.createEntityManager();
  
          ItemClass item = entityManager.find(ItemClass.class,58);
  
          System.out.println(item.getAuthor());
  
  
      }
  
  }
  </code></pre>
  <p>I reviewed another questions that were similar to my title but It doesn't help.
  can anyone plz help me to solve this issue ?</p>
  <hr />
  <p><strong>UPDATE</strong></p>
  <p>These are my rows with publish_time columns:</p>
  <p><a href="https://i.stack.imgur.com/tLhiW.jpg" rel="noreferrer">My Table</a></p>