OpenJPA
  1. OpenJPA
  2. OPENJPA-1344

Query [get|set]LockMode & Em getLockMode not throwing correct exceptions

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2, 2.0.0-M3
    • Fix Version/s: 2.0.0-beta
    • Component/s: jpa
    • Labels:
      None

      Description

      [get|set]LockMode method in Query interface do not throw correct exception per spec.

      • No check on the query type and throw IllegalStateException
      • Thrown TransactionRequiredException for LockModeType.None. (3.8.8 Queries and Lock Mode....If a lock mode other than NONE is specified for a query, the query must be executed within a transaction or the TransactionRequiredException will be thrown.)

      /**

      • Set the lock mode type to be used for the query execution.
      • @param lockMode
      • @return the same query instance
      • @throws IllegalStateException if the query is found not to be
      • a Java Persistence query language SELECT query
      • or a Criteria API query
        */
        Query setLockMode(LockModeType lockMode);

      -----------------------------

      getLockMode method in EntityManager interface do not throw correct exception per spec.

      • No check in active transaction and throw TransactionRequiredException
      • No check if entity is attached and throw IllegalArgumentException

      /**

      • Get the current lock mode for the entity instance.
      • @param entity
      • @return lock mode
      • @throws TransactionRequiredException if there is no
      • transaction
      • @throws IllegalArgumentException if the instance is not a
      • managed entity and a transaction is active
        */
        public LockModeType getLockMode(Object entity);

        Activity

        Albert Lee created issue -
        Albert Lee made changes -
        Field Original Value New Value
        Description [get|set]LockMode method in Query interface do not correct exception per spec.

        - No check on the query type and throw IllegalStationException
        - Thrown TransactionRequiredExceptin for LockModeType.None. (3.8.8 Queries and Lock Mode....If a lock mode other than NONE is specified for a query, the query must be executed within a transaction or the TransactionRequiredException will be thrown.)

        /**
        * Set the lock mode type to be used for the query execution.
        * @param lockMode
        * @return the same query instance
        * @throws IllegalStateException if the query is found not to be
        * a Java Persistence query language SELECT query
        * or a Criteria API query
        */
        Query setLockMode(LockModeType lockMode);
        [get|set]LockMode method in Query interface do not correct exception per spec.

        - No check on the query type and throw IllegalStateException
        - Thrown TransactionRequiredExceptin for LockModeType.None. (3.8.8 Queries and Lock Mode....If a lock mode other than NONE is specified for a query, the query must be executed within a transaction or the TransactionRequiredException will be thrown.)

        /**
        * Set the lock mode type to be used for the query execution.
        * @param lockMode
        * @return the same query instance
        * @throws IllegalStateException if the query is found not to be
        * a Java Persistence query language SELECT query
        * or a Criteria API query
        */
        Query setLockMode(LockModeType lockMode);
        Albert Lee made changes -
        Summary Query [get|set]LockMode not throwing correct exceptions Query [get|set]LockMode & Em getLockMode not throwing correct exceptions
        Description [get|set]LockMode method in Query interface do not correct exception per spec.

        - No check on the query type and throw IllegalStateException
        - Thrown TransactionRequiredExceptin for LockModeType.None. (3.8.8 Queries and Lock Mode....If a lock mode other than NONE is specified for a query, the query must be executed within a transaction or the TransactionRequiredException will be thrown.)

        /**
        * Set the lock mode type to be used for the query execution.
        * @param lockMode
        * @return the same query instance
        * @throws IllegalStateException if the query is found not to be
        * a Java Persistence query language SELECT query
        * or a Criteria API query
        */
        Query setLockMode(LockModeType lockMode);
        [get|set]LockMode method in Query interface do not throw correct exception per spec.

        - No check on the query type and throw IllegalStateException
        - Thrown TransactionRequiredException for LockModeType.None. (3.8.8 Queries and Lock Mode....If a lock mode other than NONE is specified for a query, the query must be executed within a transaction or the TransactionRequiredException will be thrown.)

        /**
        * Set the lock mode type to be used for the query execution.
        * @param lockMode
        * @return the same query instance
        * @throws IllegalStateException if the query is found not to be
        * a Java Persistence query language SELECT query
        * or a Criteria API query
        */
        Query setLockMode(LockModeType lockMode);

        -----------------------------

        getLockMode method in EntityManager interface do not throw correct exception per spec.

        - No check in active transaction and throw TransactionRequiredException
        - No check if entity is attached and throw IllegalArgumentException

        /**
        * Get the current lock mode for the entity instance.
        * @param entity
        * @return lock mode
        * @throws TransactionRequiredException if there is no
        * transaction
        * @throws IllegalArgumentException if the instance is not a
        * managed entity and a transaction is active
        */
        public LockModeType getLockMode(Object entity);
        Component/s jpa [ 12311304 ]
        Component/s query [ 12311309 ]
        Albert Lee made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.0 [ 12314019 ]
        Resolution Fixed [ 1 ]
        Donald Woods made changes -
        Fix Version/s 2.0.0 [ 12314019 ]
        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Albert Lee
            Reporter:
            Albert Lee
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development