Hi,

I've got a problem with JOnAS 2.3 and Oracle 8.0.5.
My entity bean has the finder method:
        <finder-method-jdbc-mapping>
           <jonas-method>
             <method-name>findByFilter</method-name>
           </jonas-method>
           <jdbc-where-clause>where (rescid = ?1 or ?1 is null) and (empid =
?2 or ?2 is null) and (starttime >= ?3 or ?3 is null) and (starttime &lt;=
?4 or ?4 is null) order by starttime</jdbc-where-clause>
        </finder-method-jdbc-mapping>

When I call findByFilter and ?1 = null or ?2 = null I get
"javax.ejb.FinderException: Failed to find bean from database
(findByFilter)".
In JOnAS log there are lines:

p0.1 : 3:25:41:111 ConnectionImpl.setAutoCommit(boolean false)
p0.1 : 3:25:41:111 ConnectionImpl.prepareStatement(String select id from
Reservation where (rescid = ? or ? is null) and (empid = ? or ? is null) and
(starttime >= ? or ? is null) and (starttime <= ? or ? is null) order by
starttime)
java.sql.SQLException: Invalid column type
p0.1 : 3:25:41:461 ConnectionImpl.close()

When ?1 != null and ?2 != null all works fine.
It looks like  pStmt.setObject(*, (java.lang.Object)p*) is cause of error.
Is it possible to solve it?

Some lines from JOnASInnerresourceBean:
    public java.util.Collection ejbFindByFilter(java.lang.Long p1,
java.lang.Long p2, java.sql.Timestamp p3, java.sql.Timestamp p4)  throws
    ....
    try {
            DataSource ds = (DataSource)(this.ejbHome.getDataSource());
            conn = ds.getConnection();
            pStmt = conn.prepareStatement("select id from Reservation where
(rescid = ? or ? is null) and (empid = ? or ? is null) and (starttime >= ?
or ? is null) and (starttime <= ? or ? is null) order by starttime");
            pStmt.setObject(1, (java.lang.Object)p1);
            pStmt.setObject(2, (java.lang.Object)p1);
            pStmt.setObject(3, (java.lang.Object)p2);
            pStmt.setObject(4, (java.lang.Object)p2);
            pStmt.setTimestamp(5, p3);
            pStmt.setTimestamp(6, p3);
            pStmt.setTimestamp(7, p4);
            pStmt.setTimestamp(8, p4);
            ResultSet rs = pStmt.executeQuery();

Thank you.




Sincerely,
Dmitry Guralnik

EMail:   [EMAIL PROTECTED]

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to