Skip to content

Instantly share code, notes, and snippets.

@jaimemin
Created June 4, 2025 01:36
Show Gist options
  • Save jaimemin/6c2995b2caf5628423afd021ce0903c9 to your computer and use it in GitHub Desktop.
Save jaimemin/6c2995b2caf5628423afd021ce0903c9 to your computer and use it in GitHub Desktop.
// Session 전체 Read-Only
Session session = entityManager.unwrap(Session.class);
session.setDefaultReadOnly(true);
// 쿼리별 Read-Only
List<Post> posts = entityManager.createQuery("select p from Post p", Post.class)
.setHint("org.hibernate.readOnly", true)
.getResultList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment