I haven't tried this (yet, will shortly), but I think what you need to do is:
return Java.wrap(recv,JavaObject.wrap( recv.getRuntime(),c.prepareStatement(sql.toString()))) Otherwise you're just returning a raw JavaObject, with no proxy (hence no methods). On 5/2/07, Ola Bini <[EMAIL PROTECTED]> wrote:
Hi, I'm investigating something that looks like a slight problem with the new JI, or with me. Basically, this code in standard JRuby Java: public static IRubyObject prepareStatement(IRubyObject recv, IRubyObject sql) throws SQLException { Connection c = (Connection)recv.dataGetStruct(); return JavaObject.wrap(recv.getRuntime(), c.prepareStatement(sql.toString())); } is bound to the method "ps" on a connection object in AR-JDBC. Now, in AR-JDBC, the Oracle adapter have this code: @stmts ||= {} @stmts[sql] ||= @connection.ps(sql) stmt = @stmts[sql] stmt.setLong(1,id) stmt.executeUpdate the problem here is that it fails. On setLong. If I replace it with setInt, it doesn't work either. Both of these methods ARE there. The error message looks like this: NoMethodError: undefined method `setLong' for [EMAIL PROTECTED]:Java::JavaObject Bill, am I doing something wrong? Is the wrap-method outdated (and if so, we have major code to rewrite)? Cheers -- Ola Bini (http://ola-bini.blogspot.com) JvYAML, RbYAML, JRuby and Jatha contributor System Developer, Karolinska Institutet (http://www.ki.se) OLogix Consulting (http://www.ologix.com) "Yields falsehood when quined" yields falsehood when quined. --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email