Skip to main content

Problem:

  • Product Name: AppServer
  • Product Version: 6.7
  • Product Component: EJB container
  • Platform/OS Version: All

The keyword "IN" in the EJB-QL caused a java.lang.RuntimeException in Borland Application Server 6.7 EJB container:

SELECT DISTINCT OBJECT(o) FROM EtySample o WHERE o.type IN (?1, ?2)

The exception is listed below:
java.lang.RuntimeException: Unknown symbol name for 18
at com.borland.ejb.ql.Scanner.sym2string(Unknown Source)
at com.borland.ejb.ql.Parser.expectError(Unknown Source)
at com.borland.ejb.ql.Parser.accept(Unknown Source)
at com.borland.ejb.ql.Parser.string_literal(Unknown Source)
at com.borland.ejb.ql.Parser.cond_primary2(Unknown Source)
at com.borland.ejb.ql.Parser.cond_primary(Unknown Source)
at com.borland.ejb.ql.Parser.cond_factor(Unknown Source)
at com.borland.ejb.ql.Parser.cond_term(Unknown Source)
at com.borland.ejb.ql.Parser.cond_expr(Unknown Source)
at com.borland.ejb.ql.Parser.select_stmt(Unknown Source)
at com.borland.ejb.ql.Parser.parseSQL(Unknown Source)
at com.borland.ejb.ql.QueryTranslater.translate(Unknown Source)
at com.borland.ejb.pm.JdbcQlFinder.translateQuery(Unknown Source)
at com.borland.ejb.pm.JdbcEntityManager.prepareJdbcQlFinder(Unknown Source)
at com.borland.ejb.pm.JdbcEntityManager.getFinder(Unknown Source)
at com.borland.ejb.pm.JdbcEntityManager.findCollection(Unknown Source)
at com.borland.ejb.pm.JdbcEntityManager.findCollection(Unknown Source)

Borland Application Server 6.7's EJB container is based on EJB2.1 specification. In EJB 2.0, the IN conditional operator can be used with String literal values only.

Resolution:

You need to rewrite the EJB-QL statement as shown below:

SELECT DISTINCT OBJECT(o) FROM EtySample o WHERE o.type = ?1 OR o.type = ?2

However, the original EJB-QL statement is valid in EJB3.0.

 


#Security
#AppServer
#EJBQL
#runtimeexception
#VisiBroker
#EJB