glassfish
  1. glassfish
  2. GLASSFISH-320

Database lock encountered when using Application-Managed Entity Manager

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 9.0pe
    • Fix Version/s: 9.0pe
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Sun

    • Issuezilla Id:
      320

      Description

      It appears as though entityManager.clear() is not clearing the PC?

      In test3, we can summarize the issue with two business methods:

      System.out.println("test3: createTestData");
      createMemberData();
      System.out.println("test3: find member");
      Member member = getMember(8);

      The DB timeout occurs on the getMember find method. This has been tried with
      and without em.joinTransaction().
      EntityManagerFactory is injected using @PersistenceUnit annotation
      EntityManager is created in bean's @PostConstruct method
      Member is a versioned entity

      public Member getMember(int memberId)

      { System.out.println("getMember"); entityManager.joinTransaction(); Member member = entityManager.find(Member.class, memberId); entityManager.clear(); return member; }

      public void createMemberData()
      {
      try {

      TestUtil.logTrace("createMemberData");
      System.out.println("Entering createMemberData()");
      entityManager.joinTransaction();

      TestUtil.logTrace("Create Member Entities");
      mRef[0] = new Member(7, "Jane Lam", false);
      mRef[1] = new Member(8, "Vinny Testa", false);
      mRef[2] = new Member(9, "Mario Luigi", true, new
      BigInteger("25000"));
      mRef[3] = new Member(10, "Sky Blue", false);
      mRef[4] = new Member(11, "Leonardi DaVinci", true, new
      BigInteger("100000"));

      System.out.println("Persist Member Entities");
      for (int i=0; i<5; i++ )

      { entityManager.persist(mRef[i]); System.out.println("persisted Member Entities"); }

      entityManager.flush();
      entityManager.clear();
      } catch (Exception e)

      { System.out.println("Unexpection while creating member data:" + e );> }

      }

      1. Client_test3.jtr
        22 kB
        smcgowan
      2. server.log
        64 kB
        smcgowan

        Activity

        Hide
        smcgowan added a comment -

        Created an attachment (id=95)
        server log

        Show
        smcgowan added a comment - Created an attachment (id=95) server log
        Hide
        smcgowan added a comment -

        Created an attachment (id=96)
        test output

        Show
        smcgowan added a comment - Created an attachment (id=96) test output
        Hide
        marina vatkina added a comment -

        Reassigned

        Show
        marina vatkina added a comment - Reassigned
        Hide
        tware added a comment -

        One of our in progress features includes the work to make clear work better.

        Show
        tware added a comment - One of our in progress features includes the work to make clear work better.
        Hide
        pkrogh added a comment -

        Will be checked in in next drop to CTS

        Show
        pkrogh added a comment - Will be checked in in next drop to CTS
        Hide
        pkrogh added a comment -

        This is now fixed and checked in to CVS.

        Show
        pkrogh added a comment - This is now fixed and checked in to CVS.

          People

          • Assignee:
            tware
            Reporter:
            smcgowan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: