• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Trouble with Hibernate3 & Postgresql 8.0.4

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Thanks!
-Faisal
[ December 30, 2005: Message edited by: Faisal Mahmoud ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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!
dave
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!