Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-dev] Rev 1442 seems to have broken checkCacheForObject via UnitOfWork if object only in Session and shouldCheckCacheOnly

Please log a bug for the issue, and I will investigate it.

 

 

-----Original Message-----
From: Sebastien Tardif [mailto:stardif@xxxxxxxxxxxx]
Sent: Tuesday, August 12, 2008 1:52 PM
To: Dev mailing list for Eclipse Persistence Services; James Sutherland
Subject: [eclipselink-dev] Rev 1442 seems to have broken checkCacheForObject via UnitOfWork if object only in Session and shouldCheckCacheOnly

 

James,

 

Your change done to ExpressionQueryMechanism.java in revision 1442 seems to have broken checkCacheForObject against UnitOfWork instance if object only exist in Session cache and shouldCheckCacheOnly is true.

 

Our existing unit test passing against TopLink 10.x is now failing with EclipseLink.

 

The first assert pass but not the second.

assertTrue(uow.getParent().getIdentityMapAccessor().isValid(timecardOldUOW));

ReadObjectQuery readObjectQuery = new ReadObjectQuery(clazz);

readObjectQuery.setCacheUsage(ReadObjectQuery.CheckCacheOnly);

readObjectQuery.setSelectionKey(getKeyFrom(timecardOldUOW));

assertNotNull(uow.executeQuery(readObjectQuery));

             

Because new code will return InvalidObject, code below will skip trying to read from session cache:

public Object checkEarlyReturn(AbstractSession session, AbstractRecord translationRow) {

        // For bug 3136413/2610803 building the selection criteria from an EJBQL string or

        // an example object is done just in time.

        // Also calls checkDescriptor here.

        //buildSelectionCriteria(session);

        checkPrePrepare(session);

 

        if (!session.isUnitOfWork()) {

            return checkEarlyReturnImpl(session, translationRow);

        }

        UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)session;

 

        // The cache check must happen on the UnitOfWork in these cases either

        // to access transient state or for pessimistic locking, as only the

        // UOW knows which objects it has locked.

        Object result = checkEarlyReturnImpl(unitOfWork, translationRow);

        if (result != null) {

            return result;

        }

 

 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=233247

 

http://fisheye2.atlassian.com/browse/eclipselink/trunk/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/queries/ExpressionQueryMechanism.java?r=1442

 


Back to the top