persistence@glassfish.java.net

Re: EJBQL compiler changes to allow parameter type checking

From: Tom Ware <tom.ware_at_oracle.com>
Date: Fri, 03 Mar 2006 12:31:20 -0500

Hi Michael,

  Changes looko good.

-Tom

Michael Bouschen wrote:

>Hi Tom,
>
>attached you find my changes to allow checking of parameter types in the
>EJBQL compiler. The corresponding glassfish issue is:
>https://glassfish.dev.java.net/issues/show_bug.cgi?id=207
>The jar EJBQL-fix207-060303.jar includes the entity-persistence changes,
>the other jar some test changes. Please have a look.
>
>Some details:
>Class EJBQueryImpl already implements checking the type of the actual
>parameter value. However, this requires calculating the type of the
>formal parameter from the usage context (and this is what my fix adds to
>the code). In an expression 'c.name = :name' the parameter :name is
>compared with a String field, so the usage context type for the
>parameter is String. I added a method validate to the parse tree nodes
>that calculates the type of the node. It also calculates the parameter
>type if the node may have parameter as arguments or operands. Class
>ParseTreeContext manages a map of parameter types and class EJBQueryImpl
> takes the formal type of a parameter from this map when checking the
>actual parameter value.
>
>I fixed a few test cases in JUnitEJBQLSimpleTestSuite, because they
>wrapped the actual parameter value into a Vector. I also added a new
>negative test to JUnitEJBQLValidationTestSuite.
>
>Thanks!
>
>Regards Michael
>
>
>

-- 
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com