Feature Requests item #643284, was opened at 2002-11-24 23:25
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376688&aid=643284&group_id=22866

Category: JBossCMP
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Pollinger (tpolling)
Assigned to: Nobody/Anonymous (nobody)
Summary: is (not) null expression very limited

Initial Comment:
The EJB QL expression <some value> IS NULL respectively
<some value> IS NOT NULL is very limited in both EJB QL
(EJB spec 2.0) and as it seems also in the current
JBossQL (I have checked version 3.0.3 and looked up the
current grammar file in the CVS repository).

In particular, with EJB QL 2.0 and JBossQL, it is not
possible to have null checks of input parameter, e.g.

<query>
  <query-method>
    <method-name>findByName</method-name>
      <method-params>                       
<method-param>java.lang.String</method-param>         
              <method-param>java.lang.String</method-param>
      </method-params>
    </query-method>
  <jboss-ql> or <ejb-ql>
    select distinct object(p) from person as p where
      (?1 is null or p.first_name = ?1) and
      (?2 is null or p.name = ?2)
  </jboss-ql> resp. </ejb-ql>
</query>

where the find method is findByName(String firstName,
String lastName) and has the semantics to match any
field value if  the argument if it is null.

As for EJB QL v 2.0, the BNF grammar states that above
is not possible:
null_comparison_expression ::=
single_valued_path_expression IS [NOT] NULL

In the current JBossQLParser.jjt, it does not appear to
be possible either:
void NullComparisonExpression() #NullComparison :
{}
{
   SingleValuedPath() <IS> [<NOT> { jjtThis.not=true; }
] <NULL>
}

In EJB QL v 2.1, however, this restriction has been lifted:
null_comparison_expression ::=
{single_valued_path_expression | input_parameter} IS
[NOT] NULL

Now, it is arguable whether or not to allow any kind of
single valued expression on the lhs of a IS [NOT] NULL
expression. Clearly, statements like "'Some string' is
null" would not make much sense semantically, however
the above expression clearly is syntactically correct
and can be reduced to return always false.

In any case, omission of input parameter null checks is
a severe restriction and forces potentially a fair
amount of SQL queries to be coded in a non portable way.




----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376688&aid=643284&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to