[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5849) AbstractQueryImpl loads non readOnly entity with session.setDefaultReadOnly(true)
Steve Ebersole (JIRA)
noreply at atlassian.com
Wed Mar 16 15:19:08 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole updated HHH-5849:
--------------------------------
Assignee: Gail Badner
Fix Version/s: (was: 3.6.next)
3.6.3
> AbstractQueryImpl loads non readOnly entity with session.setDefaultReadOnly(true)
> ---------------------------------------------------------------------------------
>
> Key: HHH-5849
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5849
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql, query-sql
> Affects Versions: 3.6.0
> Reporter: Jan Hodac
> Assignee: Gail Badner
> Fix For: 3.6.3
>
>
> When I need all loaded entities to be readOnly I use session.setDefaultReadOnly(true);
> Example:
>
> @javax.persistence.NamedQuery(name="TEST", query="select p from Person p")
> session.setDefaultReadOnly(true);
> Object object = session.getNamedQuery("TEST").uniqueResult();
> assertEquals(true,session.isReadOnly(object));
> but entity loaded by named query is non readOnly
> Problem is in AbstractQueryImpl#isReadOnly(). Field readOnly never can be null
> /**
> * {@inheritDoc}
> */
> public boolean isReadOnly() {
> return ( readOnly == null ?
> getSession().getPersistenceContext().isDefaultReadOnly() :
> readOnly.booleanValue()
> );
> }
> /**
> * {@inheritDoc}
> */
> public Query setReadOnly(boolean readOnly) {
> this.readOnly = Boolean.valueOf( readOnly );
> return this;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list