OpenJPA
  1. OpenJPA
  2. OPENJPA-533

Bulk update can`t set null embedded object

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.2.0
    • Component/s: jpa
    • Labels:
      None
    • Environment:
      Bea Weblogic 10.0 MP1

      Description

      Entity :
      @Table(name = "JOBS_APPLICATION")
      @NamedQuery(name = "Application_resetByUserId", query = "UPDATE Application a SET a.user = NULL WHERE a.user.id = :userId")

      public class Application {
      @ManyToOne
      @JoinColumn(name = "ID_USER", nullable = true)
      @ForeignKey(deleteAction=ForeignKeyAction.NULL)
      private User user;
      .............

      execting named query

      final long pUserId = 10 ;

      int result = em.createNamedQuery("Application_resetByUserId")
      .setParameter("userId", pUserId).executeUpdate() ;

      exception:

      <1.0.0 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "UPDATE Application a SET a.user = null WHERE a.user.id = :userId". Error message: Expression "UPDATEVALUE" requires at least one child.
      at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:116)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.firstChild(JPQLExpressionBuilder.java:1439)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.onlyChild(JPQLExpressionBuilder.java:1403)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.evalSetClause(JPQLExpressionBuilder.java:465)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getQueryExpressions(JPQLExpressionBuilder.java:270)
      at org.apache.openjpa.kernel.jpql.JPQLParser.eval(JPQLParser.java:61)
      at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.<init>(ExpressionStoreQuery.java:657)
      at org.apache.openjpa.kernel.ExpressionStoreQuery.newDataStoreExecutor(ExpressionStoreQuery.java:165)
      at org.apache.openjpa.datacache.QueryCacheStoreQuery.newDataStoreExecutor(QueryCacheStoreQuery.java:260)
      at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:725)
      at org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:683)
      at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:665)
      at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:565)
      at kodo.kernel.KodoQuery.compile(KodoQuery.java:75)

        Activity

        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Michael Dick made changes -
        Fix Version/s 1.2.0 [ 12313102 ]
        Pinaki Poddar made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Pinaki Poddar made changes -
        Field Original Value New Value
        Assignee Pinaki Poddar [ ppoddar@apache.org ]
        Jacek Żoch created issue -

          People

          • Assignee:
            Pinaki Poddar
            Reporter:
            Jacek Żoch
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development