You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "y616468159 (via GitHub)" <gi...@apache.org> on 2023/06/14 12:23:06 UTC
[GitHub] [ignite] y616468159 opened a new issue, #10773: When MySQL is used as the underlying storage, an exception is thrown "Can not set java.time.LocalDateTime field org.apache.ignite.examples.model.Person.createdTime to java.sql.Timestamp"
y616468159 opened a new issue, #10773:
URL: https://github.com/apache/ignite/issues/10773
### Question:
When I use IgniteCache.get(key) to get the corresponding entity, ignite throws the following error "Can not set java.time.LocalDateTime field org.apache.ignite.examples.model.Person.createdTime to java.sql .Timestamp"
### Conditions and usage:
1. In ignite 2.14.0, I use MySQL as the underlying storage;
2. In `CacheJdbcPojoStoreFactory`, I configured the mapping between the `datetime type` of the database and JDK8's `LocalDateTime`:
`new JdbcTypeField(Types.TIMESTAMP, "created_time", LocalDateTime.class, "createdTime")`
### Problem analysis:
By default, `CacheJdbcPojoStore` uses `org.apache.ignite.cache.store.jdbc.JdbcTypesTransformer#getColumnValue` to parse jdbc's ResultSet.
For the `LocalDateTime` type of JDK8, `java.sql.ResultSet#getObject(int)` is used to obtain the value of the specified column (here it is read as `java.sql.Timestamp`). When the object is finally constructed, the type is inconsistent Causes `sun.reflect.FieldAccessor#set` assignment to fail.
### Repair suggestion:
I want to parse the value of the specified column using `java.sql.ResultSet#getObject(int, java.lang.Class<T>)`, but I don't have **Ignite Jira**, how should I submit this change?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] y616468159 commented on issue #10773: IGNITE-20024 When H2 is used as the underlying storage, an exception is thrown "Can not set java.time.LocalDateTime field org.apache.ignite.examples.model.Person.createdTime to java.sql.Timestamp"
Posted by "y616468159 (via GitHub)" <gi...@apache.org>.
y616468159 commented on issue #10773:
URL: https://github.com/apache/ignite/issues/10773#issuecomment-1646852524
@ivandasch I hava created jira [IGNITE-20024](https://issues.apache.org/jira/browse/IGNITE-20024), Can you discuss this issue with me?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] IGNITE-20024 When H2 is used as the underlying storage, an exception is thrown "Can not set java.time.LocalDateTime field org.apache.ignite.examples.model.Person.createdTime to java.sql.Timestamp" [ignite]
Posted by "ZZ250-zZ (via GitHub)" <gi...@apache.org>.
ZZ250-zZ closed issue #10773: IGNITE-20024 When H2 is used as the underlying storage, an exception is thrown "Can not set java.time.LocalDateTime field org.apache.ignite.examples.model.Person.createdTime to java.sql.Timestamp"
URL: https://github.com/apache/ignite/issues/10773
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org