[Pljava-dev] Possible to override default type mappings?

From: ecf at goldencode(dot)com (Eric Faulhaber)
To:
Subject: [Pljava-dev] Possible to override default type mappings?
Date: 2006-08-07 00:51:20
Message-ID: 44D68E88.2000103@goldencode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Hello,

In order to use a pre-existing Java library which works with specialized
implementations of the basic SQL types (varchar, int, etc.), I am trying
to override the default type mappings for these types to use our
specialized classes instead of java.lang.String, java.lang.Integer, etc.

Is this possible? I keep getting an error:

test_db=# select indexOf('ABC', 'A');
ERROR: No java type mapping installed for "test.character"

I have used SQLJ to install my jar with a deployment descriptor which
adds the type mappings and creates my "indexOf(varchar, varchar)" function:

select sqlj.add_type_mapping('int', 'test.integer');
select sqlj.add_type_mapping('varchar', 'test.character');

create function indexOf(varchar, varchar) returns int
as 'test.character.indexOf(test.character, test.character)'
language java;

There are no errors at this stage and it looks as though the type
mappings were set up correctly:

test_db=# select * from sqlj.typemap_entry;
mapid | javaname | sqlname
-------+----------------+--------------------
46 | test.integer | pg_catalog.int4
47 | test.character | pg_catalog.varchar

I also use sqlj.set_classpath to set my classpath to my installed jar,
which reports no error.

I am testing with PL/Java version 1.3.0 on SUSE Linux 10, PG 8.1.3
(though I will need to support this configuration with PG 8.1.4 on
multiple Linux distros).

Thanks in advance for any help.

Regards,
Eric Faulhaber

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Peter Henderson 2006-08-08 10:55:34 [Pljava-dev] Class not found error
Previous Message Mitch Chapman 2006-07-31 22:04:30 [Pljava-dev] Stack depth limit exceeded with pljava 1.2.0