Using JPA (with Hibernate), I was inserting a record in my database.
In my table, one column is defined with a DEFAULT Value.
But when I insert a save, persist my record, JPA put it as NULL.
So using JPA, the solution was to use insertable = false in the column definition.
JPA will ignore then that column while inserting in the Database and the default value will be used.
In my table, one column is defined with a DEFAULT Value.
But when I insert a save, persist my record, JPA put it as NULL.
So using JPA, the solution was to use insertable = false in the column definition.
JPA will ignore then that column while inserting in the Database and the default value will be used.
@Column(name = "myColumn", insertable = false)
沒有留言:
張貼留言