Problem with cayenne accessing mixed case tables in Postgresql

From: Alex Gallo (koy.gall..mail.com)
Date: Wed Dec 03 2008 - 22:44:02 EST

  • Next message: Andrus Adamchik: "Re: Problem with cayenne accessing mixed case tables in Postgresql"

    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:09:23 EST