@javax.persistence.Column( updatable=false )

痴心易碎 提交于 2019-12-05 14:10:21

As documented, setting updatable=false affects only SQL UPDATE statements generated by persistence provider:

Whether the column is included in SQL UPDATE statements generated by the persistence provider.

You are still able to write such an SQL update statement that will update values in this column. This functionality defined in JPA specification, and is not Hibernate/MySQL specific.

@javax.persistence.Column( updatable=false )

The column mapped would not be updatable using HQL or via hibernate methods. In case you need to update the value in the DB you should be writing native SQL.

And if I see logically, it shouldn't allow you to update when you say updatable=false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!