Bulk update can`t set null embedded object
------------------------------------------

                 Key: OPENJPA-533
                 URL: https://issues.apache.org/jira/browse/OPENJPA-533
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 1.0.0
         Environment: Bea Weblogic 10.0 MP1
            Reporter: Jacek Żoch


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)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to