Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-55

Allow executeUpdate() invocations on native queries

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.9.7
    • query
    • None

    Description

      Currently, native queries only allow you to execute via getResultList or getSingleResult. Also allow execution through executeUpdate(). Original report:

      I have a customer who is using Kodo 4.0.1 JPA and tried to use the following line to lock back end tables:

      > String sql = "LOCK TABLE ...... IN EXCLUSIVE MODE";
      > Query q = em.createNativeQuery(sql);
      > q.executeUpdate();

      But he got errors:

      Caused by: <4|false|4.0.1> kodo.persistence.InvalidStateException: Cannot perform an update or delete operation on select query: "LOCK TABLE .... IN EXCLUSIVE MODE".
      at kodo.persistence.QueryImpl.executeUpdate(QueryImpl.java:355)

      Attachments

        Activity

          People

            wisneskid David Wisneski
            awhite A. Abram White
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: