db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: [jira] Created: (DERBY-1483) Java Function defined with a BIGINT parameter invokes the method with a signature of method(long) rather than method(Long)
Date Fri, 07 Jul 2006 04:51:26 GMT
Stan Bradbury (JIRA) wrote:

> 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());
>     }

As a related question, why would you want this to resolve to Long? Using
the primitive type long in this case will be more efficient, no need to
create a Long object. Your method could be re-written as:

>     public static String bigintToHexString(long myBigint)
>     {
> 	return Long.toHexString(myBigint);
>     }


Dan.


Mime
View raw message