I have Entity EJB's that's running on Oracle for years using standard EJB-QL. Now that we are migrating our application to use SQL Server 2005, I am getting a deployment error which puzzle's me and the BEA support engineers.
All I have changed is the <database-type> tag value from Oracle to SQLServer2000. The SQL Server drive doesn't seem to like the "?1 IS NULL" statement. I have also tried Microsoft's JDBC 1.0 & 1.2 driver with the same result. Any ideas? Thanks.
+++ My EJB-QL. ejbgen:finder signature = "ProductHierarchyLocal findByParentAndChild(java.lang.Integer parentProductId, java.lang.Integer childProductId)" ejb-ql = "SELECT DISTINCT OBJECT(o) FROM ProductHierarchyEJB o WHERE o.accountProductL.id = ?2 AND (o.parentL.accountProductL.id = ?1 OR (o.parentL IS NULL AND ?1 IS NULL))"
+++ DEPLOYMENT ERROR MESSAGE. [EJB:011082]Error while reading 'META-INF/ejb-jar.xml' or 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was:
SELECT DISTINCT OBJECT(o ) FROM ProductHierarchyEJB o WHERE o.accountProductL.id = ?2 AND ( o.parentL.accountProductL.id = ?1 OR ( o.parentL IS NULL AND =>> ?1 <<= IS NULL ) )
[EJB:013083]The argument to IS [NOT] NULL Must be a single valued path expression. for example a proper argument might be: 'WHERE employee.manager IS NULL' where an employee can only have one manager.
We found an IS [NOT] NULL argument '?1 ' which is not a single valued path expression.
SELECT DISTINCT OBJECT(o ) FROM ProductHierarchyEJB o WHERE o.accountProductL.id = ?2 AND ( o.parentL.accountProductL.id = ?1 OR ( o.parentL IS NULL AND =>> ?1 <<= IS NULL ) )
should be rewritten as:
SELECT DISTINCT OBJECT(o ) FROM ProductHierarchyEJB o WHERE o.accountProductL.id = ?2 AND ( o.parentL.accountProductL.id = ?1 OR ( o.parentL IS NULL AND ?1 IS NULL ) )
wasn't sure what you were trying to accomplish with the =>> ?1 <<= IS NULL so I took it out...it isn't valid TSQL syntax.
momi_sabag, the ?1 is an Integer (java.lang.Integer parentProductId). I am getting a deployment error. It did not get to the point that the EJB is ready to be called.
chapmandew, the "=>> ?1 <<=" is the error message with the "==>> <<=" pointing to the exact cause. My statement is just as what you have rewritten.