persistence@glassfish.java.net

Re: JPQL NPE with update query and subquery (issue 572)

From: Tom Ware <tom.ware_at_oracle.com>
Date: Wed, 19 Apr 2006 15:14:38 -0400

Hi Michael,

  Your changes look good. Go ahead and check in.

-Tom

Michael Bouschen wrote:

>Hi Tom,
>
>attached you find my changes to fix the NPE in the JPQL compiler when
>compiling an UPDATE query including a subquery.
>
>The SubqueryNode creates a ReportQuery instance for the subquery and
>then calls the subQuery method on the query's base expression passing
>the ReportQuery. The issue is that the base expression is only set for a
>SELECT query.
>
>I added some code initializing the base expression for UPDATE and DELETE
>queries. Most of the code to be changed/added is identical for UPDATE
>and DELETE, so I decided to add a new superclass ModifyNode for
>UpdateNode and DeleteNode. I also added a new method to ModifyAllQuery
>allowing to set the query's ExpressionBuilder.
>
>Please have a look at the attached changes. Thanks!
>
>Regards Michael
>
>