Sorry, it was my mistake: I forgot identity="name"
But right now I've another question: I've a database field with type
varchar2(128)
What to right - <sql name="KEY" type="varchar"/>?
In this case I've an exception:
java.lang.ClassCastException:
org.exolab.castor.mapping.loader.FieldDescriptorImpl
at org.exolab.castor.jdo.engine.SQLEngine$FieldInfo.<init>(Unknown
Source)
at org.exolab.castor.jdo.engine.SQLEngine.<init>(Unknown Source)
at org.exolab.castor.jdo.engine.BaseFactory.getPersistence(Unknown
Source)
at org.exolab.castor.persist.ClassMolder.resolve(Unknown Source)
at org.exolab.castor.persist.LockEngine.<init>(Unknown Source)
at
org.exolab.castor.persist.PersistenceEngineFactory.createEngine(Unknown
Source)
at org.exolab.castor.jdo.engine.DatabaseRegistry.<init>(Unknown
Source)
at org.exolab.castor.jdo.engine.DatabaseRegistry.<init>(Unknown
Source)
at
org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown Source)
at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
Regards,
Serge
-----Original Message-----
From: Serge Vilvovsky [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 4:31 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] DataBase JDO mapping
Hello,
1) I've a map for XML and JDO:
<class name="xmlobjects.Key" access="shared">
<description>Default mapping for class xmlobjects.Key</description>
<map-to table="CONFIGURATION" xml="key"/>
<field name="defaultValue" type="java.lang.String">
<bind-xml name="defaultValue" node="attribute"/>
</field>
<field name="name" type="java.lang.String" required="true">
<sql name="KEY" type="varchar"/>
<bind-xml name="name" node="attribute"/>
</field>
<field name="description" type="java.lang.String" required="true">
<sql name="DESCRIPTION" type="varchar"/>
<bind-xml name="description" node="attribute"/>
</field>
</class>
XML works fine, but when I use JDO mapping I receive an exception:
org.exolab.castor.mapping.MappingException: Cannot store object of type
xmlobjects.Key -- no identity field specified
at
org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(Unknown
Source)
at
org.exolab.castor.mapping.loader.MappingLoader.loadMapping(Unknown Source)
at org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(Unknown
Source)
at org.exolab.castor.mapping.Mapping.getResolver(Unknown Source)
at
org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown Source)
at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
db = jdo.getDatabase();
at XMLConverter.dbConfig(XMLConverter.java:169)
Please, explain me what's my mistake. I think an exception is thrown before
DataBase consistency checking, when I change the DB table name to unexisted,
I've got the same problem.
My database.xml file contains:
<database name="DEVDB" engine="oracle">
<driver class-name="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:DEVDB">
<param name="user" value="serge_44" />
<param name="password" value="serge_44" />
</driver>
<mapping href="mapping/GeneralMapping.xml"/>
</database>
2) Another question is what's a SID parameter for Oracle DBMS?
Regards,
Serge
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev