Session#setDefaultReadOnly is ignored by named queries

Description

When using Session#setDefaultReadOnly to get read-only entities, the setting seems to be ignored when using named queries:

I have checked back to see when it stopped working and it was Hibernate 5.2.0.Final!

Reproducer is attached (or will be attached…).

Attachments

1

Activity

Show:

Gavin King November 22, 2023 at 3:46 PM

We need to be careful here, since @NamedQuery(readOnly=true) lets you override the read-only mode. So it’s unclear which should take precedence.

Fixed

Details

Assignee

Reporter

Labels

Worked in

Components

Sprint

Fix versions

Affects versions

Priority

Created October 12, 2023 at 1:40 PM
Updated March 15, 2024 at 2:10 PM
Resolved November 23, 2023 at 11:22 AM