Hi everybody,
I'm new to castor, so maybe I'm getting something wrong. My problem
is that, when trying to store an object in my Postgres 8.1 DB, castor
puts the name of the table and of the columns in quotation marks,
which doesn't work, like (see also stack trace below):
INSERT INTO "Log_Module"
("Id","Node_Id","Node_Name","Module","Value","Date") VALUES
(?,?,?,?,?,?)
The correct statement would be:
INSERT INTO Log_Module (Id,Node_Id,Node_Name,Module,Value,Date)
VALUES (?,?,?,?,?,?)
The class associated with the object is:
public class ModuleLoggerEntity {
private int id;
private int nodeId;
private String module;
private double value;
private long date;
private String name;
// Getters/Setters, Constructor...
}
My mapping file is:
<mapping>
<class name="scatterweb.logger.ModuleLoggerEntity" identity="id">
<cache-type type="time-limited" />
<map-to table="Log_Module" />
<field name="id" type="integer">
<sql name="Id" type="integer" />
</field>
<!-- more fields... -->
</class>
<key-generator name="SEQUENCE">
<param name="sequence" value="log_module_id_seq"/>
</key-generator>
</mapping>
My JDC config is:
<jdo-conf>
<database name="scatterweb" engine="postgresql">
<driver url="jdbc:postgresql://localhost:5432/scatterweb"
class-name="org.postgresql.Driver">
<param name="user" value="xxx" />
<param name="password" value="xxx" />
</driver>
<mapping href="LogModuleMapping.xml" />
</database>
<transaction-demarcation mode="local">
<transaction-manager name="local" />
</transaction-demarcation>
</jdo-conf>
Below you see the stack trace. Does anybody know what's going wrong
in this case?
Best regards,
Abid
FATAL: [org.exolab.castor.jdo.engine.SQLStatementCreate] A fatal
error occurred while creating/updating
scatterweb.logger.ModuleLoggerEntity
using SQL: INSERT INTO "Log_Module"
("Id","Node_Id","Node_Name","Module","Value","Date") VALUES
(?,?,?,?,?,?)
java.sql.SQLException: ERROR: relation "Log_Module" does not exist
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
at
org.exolab.castor.jdo.engine.SQLStatementCreate.executeStatement(SQLStatementCreate.java:277)
at org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:313)
at
org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:694)
at org.exolab.castor.persist.LockEngine.create(LockEngine.java:496)
at
org.castor.persist.AbstractTransactionContext.walkObjectsToBeCreated(AbstractTransactionContext.java:817)
at
org.castor.persist.AbstractTransactionContext.create(AbstractTransactionContext.java:777)
at
org.exolab.castor.jdo.engine.AbstractDatabaseImpl.create(AbstractDatabaseImpl.java:302)
at scatterweb.logger.ModuleLogger.flush(ModuleLogger.java:157)
at scatterweb.logger.ModuleLogger.save(ModuleLogger.java:188)
at scatterweb.logger.TestLogger.main(TestLogger.java:40)
org.exolab.castor.jdo.PersistenceException: Nested error:
java.sql.SQLException: ERROR: relation "Log_Module" does not exist:
ERROR: relatio
n "Log_Module" does not exist
at
org.exolab.castor.jdo.engine.SQLStatementCreate.executeStatement(SQLStatementCreate.java:332)
at org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:313)
at
org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:694)
at org.exolab.castor.persist.LockEngine.create(LockEngine.java:496)
at
org.castor.persist.AbstractTransactionContext.walkObjectsToBeCreated(AbstractTransactionContext.java:817)
at
org.castor.persist.AbstractTransactionContext.create(AbstractTransactionContext.java:777)
at
org.exolab.castor.jdo.engine.AbstractDatabaseImpl.create(AbstractDatabaseImpl.java:302)
at scatterweb.logger.ModuleLogger.flush(ModuleLogger.java:157)
at scatterweb.logger.ModuleLogger.save(ModuleLogger.java:188)
at scatterweb.logger.TestLogger.main(TestLogger.java:40)
Caused by: java.sql.SQLException: ERROR: relation "Log_Module" does
not exist
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
at
org.exolab.castor.jdo.engine.SQLStatementCreate.executeStatement(SQLStatementCreate.java:277)
... 9 more
Caused by: java.sql.SQLException: ERROR: relation "Log_Module" does
not exist
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
at
org.exolab.castor.jdo.engine.SQLStatementCreate.executeStatement(SQLStatementCreate.java:277)
at org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:313)
at
org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:694)
at org.exolab.castor.persist.LockEngine.create(LockEngine.java:496)
at
org.castor.persist.AbstractTransactionContext.walkObjectsToBeCreated(AbstractTransactionContext.java:817)
at
org.castor.persist.AbstractTransactionContext.create(AbstractTransactionContext.java:777)
at
org.exolab.castor.jdo.engine.AbstractDatabaseImpl.create(AbstractDatabaseImpl.java:302)
at scatterweb.logger.ModuleLogger.flush(ModuleLogger.java:157)
at scatterweb.logger.ModuleLogger.save(ModuleLogger.java:188)
at scatterweb.logger.TestLogger.main(TestLogger.java:40)
Caused by: java.sql.SQLException: ERROR: relation "Log_Module" does
not exist
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
at
org.exolab.castor.jdo.engine.SQLStatementCreate.executeStatement(SQLStatementCreate.java:277)
at org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:313)
at
org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:694)
at org.exolab.castor.persist.LockEngine.create(LockEngine.java:496)
at
org.castor.persist.AbstractTransactionContext.walkObjectsToBeCreated(AbstractTransactionContext.java:817)
at
org.castor.persist.AbstractTransactionContext.create(AbstractTransactionContext.java:777)
at
org.exolab.castor.jdo.engine.AbstractDatabaseImpl.create(AbstractDatabaseImpl.java:302)
at scatterweb.logger.ModuleLogger.flush(ModuleLogger.java:157)
at scatterweb.logger.ModuleLogger.save(ModuleLogger.java:188)
at scatterweb.logger.TestLogger.main(TestLogger.java:40)
org.exolab.castor.jdo.PersistenceException: This thread is already
associated with a transaction in progress
at
org.exolab.castor.jdo.engine.LocalDatabaseImpl.begin(LocalDatabaseImpl.java:137)
at scatterweb.logger.ModuleLogger.flush(ModuleLogger.java:154)
at scatterweb.logger.ModuleLogger.save(ModuleLogger.java:188)
at scatterweb.logger.TestLogger.main(TestLogger.java:40)