[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5870) Cache invalidation bug: createSQLQuery(String sql) creates SQLQueryImpl with null querySpaces, making UpdateTimestampsCache:isUpToDate always return true

nodje (JIRA) noreply at atlassian.com
Tue Jan 25 22:55:05 EST 2011


Cache invalidation bug: createSQLQuery(String sql) creates SQLQueryImpl with null querySpaces, making UpdateTimestampsCache:isUpToDate always return true
---------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HHH-5870
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5870
             Project: Hibernate Core
          Issue Type: Bug
          Components: caching (L2)
    Affects Versions: 3.6.0
         Environment: OS X 10.6.6 - Java 1.6.0_22
            Reporter: nodje
            Priority: Blocker


While investigating a regression seemingly caused by cache problem on an application, I stumbled upon 

UpdateTimestampsCache:89 method public synchronized boolean isUpToDate(Set spaces, Long timestamp) throws HibernateException 

always returning true when parameter spaces Set empty.

This is the cause of my regression: QueryCache gets hit even though returned entities have been updated after the query fired first time.

While trying to understand what caused Set spaces to be empty - which to me is the cause of the error - I realized it is just created like that in SQLQueryImpl:138.

SQLQueryImpl(String sql, SessionImplementor session, ParameterMetadata parameterMetadata) {
		super( sql, null, session, parameterMetadata );
		queryReturns = new ArrayList<NativeSQLQueryReturn>();
		querySpaces = null;
		callable = false;
	}

While there's probably a way to specify querySpaces (I can only trace it to using addSynchronizedQuerySpace in SQLQuery - which is not referenced in the doc), I believe everybody expect a default behavior, i-e a default querySpace to work with, so that isUpToDate check can work properly.





-- 
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