File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate and PostgreSQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate and PostgreSQL" Watch "Hibernate and PostgreSQL" New topic
Author

Hibernate and PostgreSQL

Ravi Shankar Mukkavilli
Greenhorn

Joined: Feb 10, 2009
Posts: 12
Hello All,

I'm not really sure if I can ask this question in this forum. Anyway, I'm trying to connect to a PostgreSQL db through hibernate 3 and create a simple table. I'm able to run the code without any error, but no table is getting created. Of course Hibernate related output are not getting generated. Here is the code.



and here is the hibernate.cfg.xml file



I'm able to run and create a table successfully against a MySQL server. Is there any thing wrong with the way the db is set up. Please do take a look at the screen shot.


Thanks,
Ravi



[Thumbnail for PostgreSQL.PNG]



SCJP 1.4
SCWCD 1.4
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Your hibernate.cfg.xml doesn't have the mapped class listed in it

You need either


<mapping package="com.model"/>

or

<mapping class="com.model.User "/>

the first will find all Mapped classes in the com.model package. Whereas the second will just use the one mapped class.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ravi Shankar Mukkavilli
Greenhorn

Joined: Feb 10, 2009
Posts: 12
Thanks for the reply, I did update the hibernate.cfg.xml file and added this



the result was same, the code ran without errors and no table was created.

Ravi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate and PostgreSQL