posted 19 years ago
I am getting an error that I can't explain when attempting to execute a finder on my CMP bean. I am using WebLogic Workshop 8 with DB2.
The ejb-ql is:
* @ejbgen:finder max-elements="1000" ejb-ql="SELECT OBJECT(o) from EventBean as o where (o.eventId = ?1 or ?1 = 'BLANK') and (o.eventName LIKE ?2 or ?2 = 'BLANK') and (o.statusCode = ?3 or ?3 = 'Z')" generate-on="Local" signature="Collection finderByCriteria(java.lang.String eventId, java.lang.String eventName, char statusCode)"
The error that I'm getting is:
FinderException Exception in finderByCriteria while preparing or executing statement: 'weblogic.jdbc.wrapper.PreparedStatement_COM_ibm_db2_jdbc_app_DB2PreparedStatement@326' COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0302N The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use. SQLSTATE=22001
I only get this error when I enter in 6 or more characters into the event name param (?2).
This field is a varchar(30). I get the same problem if I remove the like, or send in %xxxx% as the param. Any idea why I might be getting this error? I tried doing straight SQL into the data base with a similar query, and I was able to execute it and get results.
Some more info on my finder:
The user may enter any pieces of criteria. Thus if they do not enter an eventId I set eventId to 'BLANK' so that the query only checks the other two fields.
Thanks in advance.
--
Dave