I have an entity Recipe, which besides all attributes also holds an attribute of java.sql.Timestamp
corresponding to column date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
in my database. I understand that jpa is providing the database with a null value of Timestamp, but I cannot think of a fix. Ideally, when inserting a new recipe, jpa should not provide a non-null value for Timestamp, but rather let database give it the default value. Or atleast this is my idea. Any idea how to help me overcome with this error? Thank you
Asked
Active
Viewed 1,408 times
0

Luis
- 51
- 1
- 10
-
You can also add `@DynamicInsert` annotation to you entity, but this has disadvantages: https://stackoverflow.com/questions/21721818/why-does-hibernate-set-dynamic-insert-false-by-default – Selaron Jan 17 '19 at 10:19
-
@Selaron I probably missed that topic when searching before this post. It worked out. Thank you – Luis Jan 17 '19 at 10:25