cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Gallo" <>
Subject Problem with cayenne accessing mixed case tables in Postgresql
Date Thu, 04 Dec 2008 03:44:02 GMT
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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message