I have been working with Spring Data JPA and MYSQL last couple of months and it has been a quite successful and smooth experience. In there i am using java 8 LocalDateTime to store the date time fields and the JPA automatically maps those fields in to mysql tinyblob columns.
Recently i got a requirement to add some data through a script to the system. In Order to fill the date time columns, i have created MYSQL TIMESTAMP variables and inserted into tinyblob columns. However system started complaining SerializationException and the root cause for that is this converted datetime columns. then i had a look at the date time columns inserted through the application as below
select CAST(drop_off_time AS CHAR(10000) CHARACTER SET utf8) From job
it looks like that when you insert through the application, it inserted as some kind of java serialization. However through a mysql script we can not replicate that functionality.
Now i have two options. 1) I need to find a way to write a mysql script to generate the Date time columns similar to the application. 2) I need to change the Spring data JPA mapping from tinyblob to an another data type which mysql scripts can support
Appreciate your help
Thanks, Keth
EDIT
After following the answers and comments provided below, i was able to find a simple solution
if you use Hibernate 5.0+, you can drop in
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-java8</artifactId>
<version>${hibernate.version}</version>
</dependency>
Then the system starts mapping the java 8 LocalDateTime prperties in to mysql DATETIME columns