• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Trouble with Hibernate3 & Postgresql 8.0.4

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am writing a web app with the following technologies:

Java 1.4.2
Tomcat 5.0.28
JSF 1.1_01
Spring 1.2
Hibernate 3
PostGreSql 8.0.4

I have a table called Tenants in my DB. The DDL is as follows:

I try to return a java.util.List of all Tenant objects mapped to this table, but I get an exception:

java.sql.SQLException: ERROR: relation "public.tenants" does not exist. I'm guessing this is problem with configuration. Because the schema and table do exist and there is data in there. Below is the log output and exception stacktrace, and below that is more information about how my app is setup and things are mapped.

Log Output & Stacktrace

Here is how Hibernate is setup in the Spring applicationContext.xml file:

Below are the Tenant object and the hibernate mapping file for this table:

This is the TenantDAO and its' implementation:

Any help would be appreciated.

[ December 30, 2005: Message edited by: Faisal Mahmoud ]
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm guessing you have a case-sensitity problem.

Your create table statement uses quotes to indicate the table name should be all upper-case in PostgreSQL:

create table "public"."TENANTS" ( ... )

Your Hibernate mapping file refers to the table name in all-caps too:
<class name="com.dv.ocs.hibernate.Tenant" table="TENANTS">

*However*, the PostgreSQL driver will convert it to all lower-case (tennants), which would account for the error message you're getting.

Try putting back ticks in the Hibernate mapping file:
<class name="com.dv.ocs.hibernate.Tenant" table="`TENANTS`">

or better yet, create the table as all lower case to begin with.

You likely have the same issue with column names as well.

I hope that helps!
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic