setting persistence context to read-only in jpa

落爺英雄遲暮 提交于 2019-12-01 20:58:36

To my knowledge there is no support for that (beyond using a user with restricted rights for the database connection) in standard JPA. But your JPA provider might support:

  • Read-only entities (e.g. with ElipseLink @ReadOnly or Hibernate @Immutable annotations)
  • Read-only queries via hints (e.g. with eclipselink.read-only set to true for EclipseLink or org.hibernate.readOnly set to true for Hibernate).

I checked the connection properties of the Microsoft JDBC driver but didn't spot anything that could help.

PS: There is a pending enhancement request for EclipseLink ( Bug 282595 ) to provide support for a read-only EntityManager. You might want to vote for it.

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