[ http://jira.jboss.com/jira/browse/JBAS-296?page=history ] Scott M Stark closed JBAS-296: ------------------------------
Resolution: Out of Date > is (not) null expression very limited > ------------------------------------- > > Key: JBAS-296 > URL: http://jira.jboss.com/jira/browse/JBAS-296 > Project: JBoss Application Server > Type: Feature Request > Components: CMP service > Reporter: SourceForge User > Assignee: Scott M Stark > > > SourceForge Submitter: tpolling . > 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. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-Development mailing list JBoss-Development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-development