Hi,

I'm having problems getting Castor to speak a dialect of SQL that
PostgresSQL will understand.. It appears that Castor generates SQL with the
table names and column names wrapped in double-quotes.. However Castor
doesn't seem to strip those double-quotes away and as a result it complains
that it can't find the specified tables..

Here's the output from the Castor log showing the SQL its generating...

[CastorPersistenceAdaptor] SQL for deleting example.EmployeeBean: DELETE
FROM "EMPLOYEES" WHERE "EMPLOYEE_ID"=?
[CastorPersistenceAdaptor] SQL for updating example.EmployeeBean: UPDATE
"EMPLOYEES" SET "NAME"=?,"DEPARTMENT_ID"=? WHERE "EMPLOYEE_ID"=? AND
"NAME"=? AND "DEPARTMENT_ID"=?
[CastorPersistenceAdaptor] SQL for loading example.EmployeeBean:  SELECT
"EMPLOYEES"."NAME","EMPLOYEES"."DEPARTMENT_ID" FROM "EMPLOYEES" WHERE
"EMPLOYEES"."EMPLOYEE_ID"=?
[CastorPersistenceAdaptor] SELECT
"EMPLOYEES"."EMPLOYEE_ID","EMPLOYEES"."NAME","EMPLOYEES"."DEPARTMENT_ID"
FROM "EMPLOYEES"

...and here's the OQL query I'm trying to run...

SELECT obj FROM example.EmployeeBean obj

...and finally here's the excpetion that's being thrown...

java.sql.SQLException: ERROR:  Relation "EMPLOYEES" does not exist
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:126)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection
.java:497)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.j
ava:320)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
ava:48)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statem
ent.java:153)
at org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.execute(Unknown Source)
at org.exolab.castor.persist.TransactionContext.query(Unknown Source)
at org.exolab.castor.jdo.engine.OQLQueryImpl.execute(Unknown Source)
at org.exolab.castor.jdo.engine.OQLQueryImpl.execute(Unknown Source)
at org.exolab.castor.jdo.engine.OQLQueryImpl.execute(Unknown Source)

I've tried the same code with SQLServer rather than PostgreSQL and that
worked fine.. I've also tried executing that exact SQL in the PostgreSQL
"psql" command line tool and it gives the same error.. However if I strip
away the double quotes it works fine..

Obviously there are plenty of people out there using Castor with PostgreSQL
successfully, so either they know the secret to get around this or I'm doing
something wrong..

Any idea what could be causing this?

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to