@javax.persistence.Column( updatable=false )

前端 未结 2 1635
小鲜肉
小鲜肉 2021-01-12 07:04

If I define a field as non-updatable, does that mean that the field can\'t be updated at all, ever? What I\'d like to do is prevent the field from getting updated when I sav

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-12 08:06

    @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

提交回复
热议问题