OpenJPA
  1. OpenJPA
  2. OPENJPA-836

after em.clear the datacache is inconsistent

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.2.0, 1.3.0
    • Fix Version/s: 1.3.0, 2.0.0-M2
    • Component/s: datacache
    • Labels:
      None
    • Environment:
      Weblogic 10.3 on WinXP EJB 3.0 (CMT)
      <property name="kodo.DataCache" value="true"/>
            <property name="kodo.RemoteCommitProvider" value="sjvm"/>

      Description

      I have the cache enabled. kodo.DataCache=true
      I update an Entity's description field (no fk);
      After the em.merge or em.persist I do an em.clear.

      In a new transaction (new webpage request) I do a select query asking for the previous entity.

      I get back the Entity but only it's id has been set. everything else is null.
      From then on all the attempts to execute the same query get the same result.

      This does not happen if kodo.DataCache=false.
      This does not happen if kodo.DataCache=true but the em.clear is not used.

      All the above operations are done using the JPA api.
      However, If I aquire manually the StoreCache I see that the Entity still exists in.
      If do a manual storeCache.evict on the specific Entity or evictAll, the problem is resolved.

      Note: The original weblogic 10.3 openjpa jar which is version 1.1 has been replaced with version 1.2.0. (and also tested with snapshot of 1.3.0)

      //CODE:
      //The only table that I use in the example is test_table.

      putData(){
      TestTable test = em.find(TestTable.class, 1);
      test.setDescription("This is a NEW description");
      em.merge(test);
      em.flush();
      em.clear();
      }

      getData(){
      TestTable test = em.find(TestTable.class, 1);
      log.debug("Description is is: "+test.getDescription());
      }

      request1: getData(); --> prints: "this is an old description"
      request2: putData();
      request3: getData();--> prints null;

        Activity

        johan jarkovic created issue -
        Hide
        johan jarkovic added a comment -

        //The only table that I use in the example is test_table.

        putData()

        { TestTable test = em.find(TestTable.class, 1); test.setId(1); test.setDescription("This is a NEW description"); em.merge(test); em.flush(); em.clear(); }

        getData()

        { TestTable test = em.find(TestTable.class, 1); log.debug("Description is is: "+test.getDescription()); }

        request1: getData(); --> prints: "this is an old description"
        request2: putData();
        request3: getData();--> prints null;

        Show
        johan jarkovic added a comment - //The only table that I use in the example is test_table. putData() { TestTable test = em.find(TestTable.class, 1); test.setId(1); test.setDescription("This is a NEW description"); em.merge(test); em.flush(); em.clear(); } getData() { TestTable test = em.find(TestTable.class, 1); log.debug("Description is is: "+test.getDescription()); } request1: getData(); --> prints: "this is an old description" request2: putData(); request3: getData();--> prints null;
        johan jarkovic made changes -
        Field Original Value New Value
        Summary after em.clear the next select query on the table (in a new transaction) returns empty Entity. after em.clear the datacache is inconsistent
        Affects Version/s 1.3.0 [ 12313326 ]
        Priority Major [ 3 ] Critical [ 2 ]
        Description I have the cache enabled. kodo.DataCache=true
        After a em.clear I do a select query on the table that I persisted. This is done on a new transaction (new webpage request).
        I get back the Entity but only it's id has been set. everything else is null.
        From then on all the attempts to execute the same query get the same result.

        This does not happen if kodo.DataCache=false.

        Note: The original weblogic 10.3 openjpa jar which is version 1.1 has been replaced with version 1.2.0.

        The query that is executed is: "select cats from Catalogues cats where cats.catalogueId=203"
        I have the cache enabled. kodo.DataCache=true
        I update an Entity's description field (no fk);
        After the em.merge or em.persist I do an em.clear.

        In a new transaction (new webpage request) I do a select query asking for the previous entity.

        I get back the Entity but only it's id has been set. everything else is null.
        From then on all the attempts to execute the same query get the same result.

        This does not happen if kodo.DataCache=false.
        This does not happen if kodo.DataCache=true but the em.clear is not used.

        All the above operations are done using the JPA api.
        However, If I aquire manually the StoreCache I see that the Entity still exists in.
        If do a manual storeCache.evict on the specific Entity or evictAll, the problem is resolved.

        Note: The original weblogic 10.3 openjpa jar which is version 1.1 has been replaced with version 1.2.0. (and also tested with snapshot of 1.3.0)
        johan jarkovic made changes -
        Description I have the cache enabled. kodo.DataCache=true
        I update an Entity's description field (no fk);
        After the em.merge or em.persist I do an em.clear.

        In a new transaction (new webpage request) I do a select query asking for the previous entity.

        I get back the Entity but only it's id has been set. everything else is null.
        From then on all the attempts to execute the same query get the same result.

        This does not happen if kodo.DataCache=false.
        This does not happen if kodo.DataCache=true but the em.clear is not used.

        All the above operations are done using the JPA api.
        However, If I aquire manually the StoreCache I see that the Entity still exists in.
        If do a manual storeCache.evict on the specific Entity or evictAll, the problem is resolved.

        Note: The original weblogic 10.3 openjpa jar which is version 1.1 has been replaced with version 1.2.0. (and also tested with snapshot of 1.3.0)
        I have the cache enabled. kodo.DataCache=true
        I update an Entity's description field (no fk);
        After the em.merge or em.persist I do an em.clear.

        In a new transaction (new webpage request) I do a select query asking for the previous entity.

        I get back the Entity but only it's id has been set. everything else is null.
        From then on all the attempts to execute the same query get the same result.

        This does not happen if kodo.DataCache=false.
        This does not happen if kodo.DataCache=true but the em.clear is not used.

        All the above operations are done using the JPA api.
        However, If I aquire manually the StoreCache I see that the Entity still exists in.
        If do a manual storeCache.evict on the specific Entity or evictAll, the problem is resolved.

        Note: The original weblogic 10.3 openjpa jar which is version 1.1 has been replaced with version 1.2.0. (and also tested with snapshot of 1.3.0)

        //CODE:
        //The only table that I use in the example is test_table.

        putData(){
           TestTable test = em.find(TestTable.class, 1);
            test.setDescription("This is a NEW description");
            em.merge(test);
            em.flush();
            em.clear();
        }

        getData(){
              TestTable test = em.find(TestTable.class, 1);
              log.debug("Description is is: "+test.getDescription());
        }


        request1: getData(); --> prints: "this is an old description"
        request2: putData();
        request3: getData();--> prints null;
        Hide
        Catalina Wei added a comment -

        Fix checked in trunk: r734551 & 1.3.x : r734550

        Show
        Catalina Wei added a comment - Fix checked in trunk: r734551 & 1.3.x : r734550
        Catalina Wei made changes -
        Assignee Catalina Wei [ fancy ]
        Fix Version/s 1.3.0 [ 12313326 ]
        Fix Version/s 2.0.0 [ 12313483 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        johan jarkovic added a comment -

        Fix Verified on latest 1.3 snapshot!

        Show
        johan jarkovic added a comment - Fix Verified on latest 1.3 snapshot!
        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Catalina Wei
            Reporter:
            johan jarkovic
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development