How to make an Entity read-only?

后端 未结 9 1265
情歌与酒
情歌与酒 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:08

    I think what you are looking for is your entity to be Immutable. Hibernate supports this; JPA(at least JPA 1.0) does not. I suppose you can only control this by providing only getters and make sure that the getters return only immutable values.

提交回复
热议问题