How to make an Entity read-only?

后端 未结 9 1303
情歌与酒
情歌与酒 2020-12-03 00:43

What is the proper way to make an Entity read-only with JPA ? I wish my database table to never be modified at all programmatically.

I think I understand that I sho

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 01:00

    If your JPA implementation is hibernate - you could use the hibernate Entity annotation

    @org.hibernate.annotations.Entity(mutable = false)
    

    Obviously this will tie your model to hibernate though.

提交回复
热议问题