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.