Jakob Braeuchi wrote:
hi horacio,

you'll have to quote the tablename in the repository. ojb currently does not support automatic quoting.

hth
jakob


Hi again! I've add " to the table name, but I have other problems now.

<class-descriptor
   class="ar.com.hdeoro.eua.model.JabberRosterItem"
   table="&quot;roster-items&quot;">

The problem is the columns collection-owner, object-sequence, etc. (with '-' in its names):

If I use: (without &quot;)

     <field-descriptor
        name="collectionOwner"
        column="collection-owner"
        jdbc-type="VARCHAR"
        primarykey="true"/>

I get:

org.postgresql.util.PSQLException:
    ERROR: column a0.collection does not exist

If I use: (with &quot;)

     <field-descriptor
        name="collectionOwner"
        column="&quot;collection-owner&quot;"
        jdbc-type="VARCHAR"
        primarykey="true"/>

I get:

org.apache.ojb.broker.PersistenceBrokerException:
Error reading class type: ar.com.hdeoro.eua.model.JabberRosterItem
from result set, current read field was collectionOwner
(...)
Caused by: org.postgresql.util.PSQLException: The column name "collection-owner" not found.
at org.postgresql.jdbc1.AbstractJdbc1ResultSet.findColumn(AbstractJdbc1ResultSet.java:677)
at org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:479)
at org.apache.ojb.broker.util.JdbcTypesHelper$T_Varchar.readValueFromResultSet(JdbcTypesHelper.java:378)
at org.apache.ojb.broker.util.JdbcTypesHelper$BaseType.getObjectFromColumn(JdbcTypesHelper.java:302)
at org.apache.ojb.broker.util.JdbcTypesHelper$BaseType.getObjectFromColumn(JdbcTypesHelper.java:281)
at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(RowReaderDefaultImpl.java:201)
... 12 more



This time, the SELECT was ok, but OJB fail to get the values for that field... findColumn() should be called without the double quotes arround the column name...


So, what to do with this? Is anyone working with ojb and column names with '-' in its names?

Thanks in advance!

Horacio




Horacio de Oro schrieb:

Hi!

I'm having a problem with OJB with a table of Jabber. The table name is roster-items and is on a PostgreSQL server.

When I try to store() an object (using the PB api) I get this log:

[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl]
  DEBUG: SQL:INSERT INTO roster-items
    (collection-owner,jid,ask,from,name,object-sequence,to)
    VALUES (?,?,?,?,?,?,?)

and this exception:

org.apache.ojb.broker.PersistenceBrokerSQLException:
   SQL failure while insert object data for class
   JabberRosterItem (...)
   exception message is [ERROR: syntax error at or near "-"]

I think Ojb has troubles with the table name. If I execute this on psql:

SELECT * FROM roster-items;

I get this error:

jabberd2=# SELECT * FROM roster-items;
ERROR:  syntax error at or near "-" at character 21

The valid SQL for viewing the roster-items table is:

SELECT * FROM "roster-items";

The same happen with ANY table containing the '-' character, and this is fixed if you put the table name between double quotes...

Is there any way to make Ojb put the table name between double quotes?

Thanks in advance!

Horacio


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to