Hi Alex,
Quoting identifiers is one of the things that we promised to give our
users for some time [1], and still haven't implemented. I feel pretty
bad about the delay with this issue, but alas, it is not there...
For now I would suggest quoting DbEntity (table) names in
CayenneModeler. That's not tested though, so please let us know if you
run into problems with this workaround.
Andrus
[1] https://issues.apache.org/cayenne/browse/CAY-289
On Dec 4, 2008, at 5:44 AM, Alex Gallo wrote:
> I am trying to create a standalone database application with a PgSQL
> (ver
> 8.3) database backend with a java frontend. I have been tinkering
> around
> with cayenne (ver 2.0.4) for database access. The database is an
> existing
> one and uses mixed case for naming database columns and tables.
>
> When using a SelectQuery, I always get the access problem "<tablename>
> relation does not exist". I can trace this problem to the mixed case
> naming
> in the database. PgSQL recommends placing double quotes (" ") around
> DB
> entities in queries to overcome this problem. However when using
> cayenne,
> the default behavior is sending the query unquoted, wherein PgSQL
> database
> then transforms the table names and column names in the submitted
> query to
> lower case (as its default behavior for queries) thereby causing the
> error.
>
> I tried using SQLTemplates and NamedQuery to overcome this behavior,
> which
> works well that is until a certain DB object/table contains
> dependencies on
> other tables. What happens is, though the query for object1 is
> correct, when
> cayenne fetches object2 the query sent to the DB is again unquoted,
> which
> starts the problem over again. A workaround I have tried is to query
> object2
> first using SQLTemplates or NamedQuery (to store the records in the
> DataContext cache) before querying object1. Another workaround I see
> is try
> to rename every table and column in the database. Either way, I
> don't see
> either solution as being practical.
>
> I must admit I am still new to cayenne and I am still feeling my way
> around
> it. I have tried searching for answers or documentation relevant to
> this
> problem but I haven't come across any solution. Any help that can be
> extended will be much appreciated.
>
> Alex Gallo
This archive was generated by hypermail 2.0.0 : Thu Dec 04 2008 - 01:21:45 EST