On Thu, 05 Dec 2002 10:40:57 +0100, Micka�l Guessant wrote:

Hello Mike, hello Mickael,

this is probably an FAQ item, as it was asked several times before.
The key issue here is:
Postgres lowercases all table/column names before interpreting them if and
only if there are no quotes around them.
So, there are two solutions to your problem:
1. Lowercase all table and column names in your mapping.xml
2. Recreate all your tables and using uppercase WITH quotes
   around each identifier mentioning table or column names.
The second one is probably a PITA. I use lowercased names all around,
because even psql isn't capable of correctly autocomplete these
uppercase created table names, so you have to type them completely.

hope that helps...

Patric


>It may be a Postgresql JDBC driver issue, you can try with the one
>included in Castor.
>
>Mike Freame wrote:
>> 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
>> 
>> 
>> 
>
>
>-- 
>Mickael Guessant
>
>----------------------------------------------------------- 
>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

Reply via email to