Donnie Armstrong wrote:
Werner thanks for your help.
My environment JBoss 3.2.3 + Oracle 10g + Oracle XA + Castor 0.9.5.3
I would like the database.xml file to use the JNDI datasource instead of stand-alone JDBC connection. When I invoke qry.execute(Database.ReadOnly), I receive an exception. I am at a loss as how to tell Castor to ignore setAutoCommit() on the connection.
The below code works fine if i change database.xml to use stand-alone
jdbc.
database.xml => <database name="at4" engine="oracle"> <jndi name="java:/AT4ServerDS" /> <mapping href="conf/castor_mapping.xml" /> </database>
Code snippet =>
try {
// construct JDO adapter
JDO jdo = new JDO("at4");
// load database file
jdo.setConfiguration(getClass().getClassLoader().getResource(dbFileName).toString());
// aquire database handle
Database db = jdo.getDatabase();
// initialize castor transaction db.begin();
// initialize query OQLQuery qry = db.getOQLQuery("SELECT p FROM com.attempt4.framework.oracle.DatasetLayoutBean p where p.dataSetName = $1");
// bind parameters qry.bind(datasetName);
// execute query (read-only) QueryResults results = qry.execute(Database.ReadOnly);
Stack Trace => ERROR 11:32:39,877 [STDERR] java.sql.SQLException: You cannot set autocommit during a managed transaction! ERROR 11:32:39,878 [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.setJdbcAutoCommit(BaseWrapperManagedConnection.java:440) ERROR 11:32:39,878 [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.java:446) ERROR 11:32:39,879 [STDERR] at org.exolab.castor.jdo.engine.TransactionContextImpl.getConnection(TransactionContextImpl.java:211)
Donnie,
The exception above makes me think that you've got the DataSource configured improperly in JBoss. Please post your *-ds.xml file so that we can see how the DataSource is configured.
Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\\"F9E<G)E=\\$\\!F<FEI+F-O;0\\`\\`");'
The Castor Project http://www.castor.org/
Apache Geronimo http://incubator.apache.org/projects/geronimo.html
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
