Skip to content Skip to sidebar Skip to footer

Jparepository Sql Syntax Error When Trying To Save To Mysql Date

I have the following row in my MySQL Table: https://i.stack.imgur.com/u0FC4.png This column is represented as: @Column(name='release') @DateTimeFormat(pattern = 'yyyy-MM-dd

Solution 1:

According to your feedback, remoing @DateTimeFormat resolves the issue with the database mapping - so this is the first thing.

Next I would recommend to separate the data transfer objects used for the forms from the actual entities. It will help a lot in the long run. So you have a MovieDTO for form binding, where you can put @DateTimeFormat and other form validations like @NotNull. Then you will need to map the movieDto object to the movie entity before persisting.

Solution 2:

Turns out the problem was with the column name in MySQL - release is a protected word and causes issues with the query when used. Should have noticed when I tried to drop the column, as it would not auto-fill the name like it does for other columns...

Post a Comment for "Jparepository Sql Syntax Error When Trying To Save To Mysql Date"