• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and PostgreSQL

 
Ravi Shankar Mukkavilli
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
PostgreSQL.PNG
[Thumbnail for PostgreSQL.PNG]
PostgreSQL screenshot
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ravi Shankar Mukkavilli
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic