Hi Ralf,
Thanks for your prompt response. I'm not sure how this bug you mentioned
applies as its about Oracle throwing an SQLException and this seems bound to
_persistence staying null in
org.exolab.castor.persist.ClassMolder.create(TransactionContext, OID,
DepositBox, Object)
I'm also not sure how this will help but here's the code for how I'm
initializing connection using JDOConfFactory (no jdo-conf.xml)...
String engine = m_props.getProperty("db.engine"); String driver =
m_props.getProperty("db.driver");
String url = m_props.getProperty("db.url");
String database_name = m_props.getProperty("db.name"); String map =
m_props.getProperty("db.map"); String username =
m_props.getProperty("db.user"); String password =
m_props.getProperty("db.password");
Properties props = new Properties();
props.put("URL", url);
props.put("user", username);
props.put("password", password);
DataSource driverConf = JDOConfFactory.createDataSource(driver, props);
Mapping mappingConf =
JDOConfFactory.createMapping(getClass().getResource(map).toString());
Database dbConf = JDOConfFactory.createDatabase(database_name, engine,
driverConf, mappingConf);
try
{
JDOManager.loadConfiguration(JDOConfFactory.createJdoConf(dbConf));
jdo = JDOManager.createInstance(database_name);
}
catch(MappingException ex)
{
m_logger.fatal("ConnectionManager caught a MappingException trying to
get an instance of JDOManager: " + ex.getMessage()); }
Database connection = jdo.getDatabase();
I also tried pulling the head revision out of CVS and compiling myself a
fresh JAR and still get the exact same problem so it looks like its still
not fixed. This bug has my whole project in a headlock right now.
In my desperation I thought I might give the JUnit tests a try next to make
sure everything was passing. To my horror after compiling the latest build
and loading up oracle.sql into my DB and running the tests (test
castor.oracle) I found that the build seems to have major issues running
against my Oracle10gXE database (see my follow up mail with attachment).
What's going on here? Am I just doomed and should look for a different
persistence framework at this point? I really don't want to since Castor
seems so promising. Can anyone help?
Thanks,
Yuri Green
CTO
sourceOut Inc.
e: [EMAIL PROTECTED]
c: 510.305.8634
-----Original Message-----
From: Ralf Joachim [mailto:[EMAIL PROTECTED]
Sent: Monday, November 28, 2005 2:16 AM
To: [email protected]
Subject: Re: [castor-user] 'PersistenceException: non persistence capable'
trying to use key-generator SEQUENCE in Oracle10g / castor-0.9.9.1
Hi Yuri,
we had a problem with sequence key generator that apears in 0.9.9 and
0.9.9.1 releases of Castor. The problem is tracked by:
http://jira.codehaus.org/browse/CASTOR-1264
and has been resolved in CVS some days ago. As the exception you get is
a different one and max key generator also failed for you i think you
are hit by something else. I can not see any mistake in the information
you provided. For me it looks like your mapping have not been loaded.
Can you please also post your jdo-conf.xml and the code how you
initialized 'connection' which should be an instance of Database interface?
Regards
Ralf
Yuri Green schrieb:
Hi everyone,
As a simple test before I wired up the rest of my code to use Castor I set
up a simple table in my Oracle server with two columns in it to test JDO
and
make sure everything was copasetic. As it stands, I can't seem to get a
class defined in my mapping file to use a key-generator I defined for an
existing sequence in Oracle. I even tried all of the other algorithms like
MAX with no success. I'm in a real bind here because without the ability
to
create or use a built-in auto-incrimination system here it renders the
persistence framework useless. Here's the SQL for my test table and the
related sequence:
CREATE TABLE test (
id VARCHAR2(32) PRIMARY KEY,
test_field VARCHAR2(32) NOT NULL
);
CREATE SEQUENCE test_id_seq INCREMENT BY 1 START WITH 1;
Here's what's in my mapping.xml file:
<key-generator name="SEQUENCE" alias="A">
<param name="sequence" value="test_id_seq"/>
</key-generator>
<class name="com.sourceout.db.object.Test" identity="id"
key-generator="A">
<description>test table</description>
<map-to table="test" />
<field name="id" type="string">
<sql name="id" type="varchar" />
</field>
<field name="testField" type="string">
<sql name="test_field" type="varchar" />
</field>
</class>
Here's the contents of com.sourceout.db.object.Test:
public class Test
{
String id = null;
String testField = null;
public Test() {
}
/**
* @return Returns the id.
*/
public String getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(String id) {
this.id = id;
}
/**
* @return Returns the testField.
*/
public String getTestField() {
return testField;
}
/**
* @param testField The testField to set.
*/
public void setTestField(String testField) {
this.testField = testField;
}
}
When I try to run my test code:
Test test = new Test();
test.setTestField("some test data");
connection.begin();
connection.create(test);
connection.commit();
connection.close();
I get:
PersistenceException: non persistence capable:
com.sourceout.db.object.Test
Now this seems like the most vanilla test I can run and I've been sifting
through bug reports and the documentation all day trying to find an answer
but with no luck at all. The idea here seems simple, just set the "id"
field
using a key-generator or a predefined Oracle trigger so that the coder
doesn't have to know about the current value of the id field to do a
simple
insert with the interesting data. I can't even get the pre-existing Oracle
side trigger approach to work by sticking in a <param name="trigger"
value="true"/> info my <key-generator> definition and loading up the
trigger
PL/SQL.
I'm in a real bind here. Is this a known bug that's getting worked on
because I didn't see anything specific to my example in the bug database.
No
one else seems to be experiencing this so am I doing something wrong or am
I
the first to try this in this environment?
Yuri Green
CTO
sourceOut Inc.
e: [EMAIL PROTECTED]
c: 510.305.8634
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------