I resolved the issue. The bug was in
org.exolab.castor.jdo.keygen.IdentityKeyGenerator.
public void supportsSqlType( int sqlType )
// derby doesn't support numeric as an identity column
// if (sqlType != Types.NUMERIC &&
if (sqlType != Types.NUMERIC &&
fName.equals("derby")) {
throw new MappingException(
Messages.format("mapping.keyGenSQLType",
getClass().getName(), new Integer(sqlType)));
}
}
----- Original Message -----
From: "Stephen Ince" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 07, 2008 8:14 PM
Subject: [castor-user] derby IDENTITY key generator
I am trying to use IDENTITY key generator but I am getting the follow
error. Do I need to set a data type for the INDENTITY key generator? I
looked at the 1.01 code and Integer is supported. Am I missing something?
Error
-----------------------------------------------------------------------------------
0 [main] FATAL engine.BaseFactory - A fatal exception occurred:
org.exolab.cast
or.mapping.MappingException: Key generator
org.exolab.castor.jdo.keygen.Identity
KeyGenerator doesnt support SQL type {1}.
Here is a sample test case.
SQL
----------------------------------------
create table my_class (
id int not null primary key generated by default as identity ,
string_value varchar(200) not null
) ;
mapping
------------------------------------------
<class name="test.MyClass" identity="id" key-generator="IDENTITY">
<map-to xml="my-class" table="my_class"/>
<field name="id" type="integer">
<bind-xml transient="true"/>
<sql name="id" type="integer"/>
</field>
Steve
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email