db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
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 22:17:11 GMT
Daniel John Debrunner wrote:
> 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.
>
>
>   
Hi Dan -
I have no need to resolve to a Long, I expected that it would resolve to 
a Long because the information on BIGINT in the manuals.  It lists 
java.lang.Long as the compile time type for BIGINT (though I must admit 
to not understanding what a 'Compile time type' is).

As I understand it now, all Derby numeric datatypes that have a 
corresponding primitive type will resolve to the primitive type when 
passed as a parameter to a Derby java function or stored procedure.  I 
will get this information onto the WIKI so it is available for others to 
reference, review and add to.

Thanks again for the help with this issue.


Mime
View raw message