Um... I found an answer that worked, but it's not your solution. I'm 
really unsure on the double quotes being used at all. I edited the
class: org.exolab.castor.jdo.drivers.PostgreSQLFactory.

Below is my cvs diff of what I did. In essence I just removed the
double quoting from the SQL factory  for PostgreSQL and all is 
happy. Haven't had trouble since.


Index: src/main/org/exolab/castor/jdo/drivers/PostgreSQLFactory.java
===================================================================
RCS file: 
/cvs/castor/castor/src/main/org/exolab/castor/jdo/drivers/PostgreSQLFactory.java,v
retrieving revision 1.9
diff -r1.9 PostgreSQLFactory.java
94c94,95
<         int index;
---
>           return name;
>         //int index;
96,99c97,100
<         index = name.indexOf( '.' );
<         if ( index > 0 )
<             return "\"" + name.substring( 0, index ) + "\".\"" + name.substring( 
index + 1 ) + "\"";
<         return '"' + name + '"';
---
>         //index = name.indexOf( '.' );
>         //if ( index > 0 )
>             //return "\"" + name.substring( 0, index ) + "\".\"" + name.substring( 
>index + 1 ) + "\"";
>         //return '"' + name + '"';

Later

Weave


Patric Bechtel [[EMAIL PROTECTED]] wrote:
> On Fri, 27 Jul 2001 14:24:11 -0400, Brian Weaver wrote:
> 
> The problem is not the statement, but your tables.
> If you use "Foo" in a query, it will scan for a table named Foo (with
> capital F), without the quotes it will (only!) scan for a table named
> foo (with lower case f).
> So what you've done is, you built your table events with a column
> named eventid, and Castor wants it be named eventID.
> Two solutions: Correct the mapping (sql name="eventid") or
> rename the column inside PostgreSQL (alter table...).
> 
> hope that helps...
> 
> 
> 
> >Hi,
> >
> >I've been playing with Castor for the past few days, looking
> >through the code when I've run into errors. I've finally
> >got my mapping.xml, database.xml, and java classes all "working"...
> >
> >Now when I execute an OQL statement it returns the following
> >error:
> >
> >org.exolab.castor.jdo.PersistenceException: Nested error: java.sql.SQLException: 
>ERROR:  No such attribute or 
> function 'eventID'
> > while executing SELECT 
> 
>"events"."eventID","events"."eventUei","events"."nodeID","events"."eventTime","events"."eventHost","events"."ipAd
> 
>dr","events"."eventDpName","events"."eventSnmpHost","events"."serviceID","events"."eventSnmp","events"."eventParm
> 
>s","events"."eventCreateTime","events"."eventDescr","events"."eventLoggroup","events"."eventLogmsg","events"."eve
> 
>ntSeverity","events"."eventPathOutage","events"."eventCorrelation","events"."eventSuppressedCount","events"."even
> 
>tOperInstruct","events"."eventAutoAction","events"."eventOperAction","events"."eventOperActionMenuText","events".
> 
>"eventNotification","events"."eventTticket","events"."eventTticketState","events"."eventForward","events"."eventM
> 
>ouseOverText","events"."eventLog","events"."eventDisplay","events"."eventAckUser","events"."eventAckTime"
> FROM 
> "events"
> >java.sql.SQLException: ERROR:  No such attribute or function 'eventID'
> >
> >     at org.postgresql.Connection.ExecSQL(Connection.java:533)
> >     at org.postgresql.jdbc2.Statement.execute(Statement.java:294)
> >     at org.postgresql.jdbc2.Statement.executeQuery(Statement.java:59)
> >     at 
>org.postgresql.jdbc2.PreparedStatement.executeQuery(PreparedStatement.java:108)
> >     at org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.execute(SQLEngine.java:1576)
> >     at 
>org.exolab.castor.persist.TransactionContext.query(TransactionContext.java:616)
> >     at org.exolab.castor.jdo.engine.OQLQueryImpl.execute(OQLQueryImpl.java:457)
> >     at org.exolab.castor.jdo.engine.OQLQueryImpl.execute(OQLQueryImpl.java:404)
> >     at org.opennms.netmgt.db.Test.run(Test.java:73)
> >     at org.opennms.netmgt.db.Test.main(Test.java:33)
> >
> >I took the 'SELECT ... FROM "events"' and feed that into
> >pgsql. It didn't like it, but if I stripped out the double
> >quotes from the entire statement it worked fine...
> >
> >How do I disable the quoting around each element in castor. I'm working
> >with the latest CVS tree.
> >
> >Weave
> >
> >----------------------------------------------------------- 
> >If you wish to unsubscribe from this mailing, send mail to
> >[EMAIL PROTECTED] with a subject of:
> >     unsubscribe castor-dev
> >
> >
> 
> 
> sincerely,
> 
> Patric Bechtel
> IPCON Informationssysteme
> 
> PGP Public Key Fingerprint: 5579 8D11 C4A4 DD84  1CC0 D2D1 112F A924
> 
> ----------------------------------------------------------- 
> 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