Details

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

      Operating System: All
      Platform: All

    • Issuezilla Id:
      367

      Description

      I have this entity:

      @NamedQuery(
      name="findByPK"
      query="SELECT OBJECT(o) from A where o.id = :id"
      )
      @Entity
      public class A {
      private int id;
      @Id public int getId()

      { return id; }

      public void setId(int i)

      { id = i; }

      }

      If I execute this code:

      Query q = em.findNamedQuery("findByPK");
      q.setParameter("id", id);
      q.setHint("lockMode", new Short((short) 1));
      A a = (A) q.getSingleResult();

      The getSingleResult() method throws
      javax.persistence.NonUniqueResultException: More than one result was
      returned from Query.getSingleResult()

      In fact, if I get the list from the query, the query has returned every
      instance of A in the database (and if I trace the SQL, I see that the executed
      SQL is "select id from a" and not "select id from a where id = ?").

      If I remove the hint, the code executes correctly.

        Activity

        Hide
        Scott Oaks added a comment -

        Created an attachment (id=165)
        Test Case

        Show
        Scott Oaks added a comment - Created an attachment (id=165) Test Case
        Hide
        guypelletier added a comment -

        Assigning to myself ...

        Show
        guypelletier added a comment - Assigning to myself ...
        Hide
        guypelletier added a comment -

        I was able to reproduce this error using build 37. Then noticed the error went
        away when I re-ran the test against our latest persistence code. So, looks like
        this problem should be fixed in the next persistence drop.

        Show
        guypelletier added a comment - I was able to reproduce this error using build 37. Then noticed the error went away when I re-ran the test against our latest persistence code. So, looks like this problem should be fixed in the next persistence drop.
        Hide
        tware added a comment -

        Fixed in latest drop

        Show
        tware added a comment - Fixed in latest drop
        Hide
        marina vatkina added a comment -

        Added build #

        Show
        marina vatkina added a comment - Added build #

          People

          • Assignee:
            guypelletier
            Reporter:
            Scott Oaks
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: