Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 7194 invoked from network); 12 Jul 2006 20:55:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Jul 2006 20:55:33 -0000 Received: (qmail 87292 invoked by uid 500); 12 Jul 2006 20:55:31 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 87246 invoked by uid 500); 12 Jul 2006 20:55:31 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 87162 invoked by uid 99); 12 Jul 2006 20:55:31 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jul 2006 13:55:31 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jul 2006 13:55:30 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9DB804104FC for ; Wed, 12 Jul 2006 20:53:31 +0000 (GMT) Message-ID: <6225112.1152737611642.JavaMail.jira@brutus> Date: Wed, 12 Jul 2006 20:53:31 +0000 (GMT+00:00) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-1483) Java Function defined with a BIGINT parameter invokes the method with a signature of method(long) rather than method(Long) In-Reply-To: <20786272.1152245430237.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-1483?page=comments#action_12420731 ] Kathey Marsden commented on DERBY-1483: --------------------------------------- Is this current doc reference sufficient? http://db.apache.org/derby/docs/10.1/ref/rrefjdbc75719.html > Java Function defined with a BIGINT parameter invokes the method with a signature of method(long) rather than method(Long) > -------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-1483 > URL: http://issues.apache.org/jira/browse/DERBY-1483 > Project: Derby > Type: Bug > Components: Documentation > Versions: 10.1.2.1 > Reporter: Stan Bradbury > Priority: Minor > > Calling a function passing BIGINT to a method accepting Long fails with the message: > ERROR 42X50: No method was found that matched the method call derbyJavaUtils.bigintToHexString(long), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible. > The method needs to accept the primative type: long to work. BIGINT as docuemented as having a compile time type of java.lang.Long - this is why I expected the example method to work: see the Reference manual: http://db.apache.org/derby/docs/10.1/ref/rrefsqlj30435.html. > > Example: define the function bigintToHexString to accept a BIGINT parameter (see below) and reference the corresponding java method bigintToHexString (shown below) that accepts a Long. Add the jarfile with the class to the DB, setup the database classpath and invoke with the query shown. > >>> Java Class: > import java.sql.*; > public class derbyJavaUtils > { > // bigintToHexString > public static String bigintToHexString(Long myBigint) > { > return myBigint.toHexString(myBigint.longValue()); > } > // bigintToHexString2 - this will work if used for the function > public static String bigintToHexString2(long myBigint) > { > Long myLong = null; > return myLong.toHexString(myBigint); > } > } > >> COMPILE IT AND JAR IT : jar -cvf derbyJavaUtils.jar DerbyJavaUtils.class > >> Setup the function as follows in a database: > .. CALL sqlj.install_jar( 'derbyJavaUtils.jar','APP.derbyJavaUtils',0); > .. CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.classpath', 'APP.derbyJavaUtils'); > .. CREATE FUNCTION app.bigintToHexString(hexString bigint) > RETURNS VARCHAR(16) > PARAMETER STYLE JAVA NO SQL > LANGUAGE JAVA > EXTERNAL NAME 'derbyJavaUtils.bigintToHexString' > === One possible test query: > select 'C' || bigintToHexString2(CONGLOMERATENUMBER) || '.dat', TABLENAME, ISINDEX > from SYS.SYSCONGLOMERATES a, SYS.SYSTABLES b > where a.TABLEID = b.TABLEID > As mention in the code comments the method: bigintToHexString2 - will work if used for the function -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira