4

Im using Netbeans 7.3, Windows 7, Postgres 9.2,
I created a Java Web project with Hibernate 3.2.5 (driver = postgresql-9.2-1002.jdbc4)

I added the new project with the postgres database info,
after I created the reverse engineering file with the NetBeans tool
and finally I used the Wizard "Hibernate Mapping Files and POJOS from Database..."
and it doesn't create the classes,
I tested it with MySql and It works prefect.

The problem is when I use Hibernate with Postgres.

Kuchi
  • 4,204
  • 3
  • 29
  • 37
Hedu911
  • 133
  • 3
  • 12
  • "Hibernate 3.2.5". Um. What? Why use an ancient patch release of an ancient major version of Hibernate rather than the latest in the 3.x series or preferably Hibernate 4? You're missing *years* of bugfixes. – Craig Ringer May 13 '13 at 07:14
  • I updated my hibernate version to the last one and I still have the problem – Hedu911 May 14 '13 at 05:04

4 Answers4

1

I use this same environment (except for the Hibernate version).

When you go to the Services tab under Databases, does your JDBC connection to Postgres appear? If so, can you successfully connect to it an execute a query?

Under the 'New Hibernate Mapping Files and POJOS from Database' dialog, I assume you have the Code Generation Settings for Domain Code selected as well.

And .. does your hibernate.reveng.xml file have entries for elements? These map 1:1 to tables in your database.

user1351763
  • 126
  • 4
  • yes, I'm able to see the JDBC connection and I can execute queries and my hibernate.reveng.xml file have my table entry – Hedu911 May 14 '13 at 05:02
0

Uh,in your connect db ,must design database name , like jdbc:mysql://ip:3306/yourdb?useUnicode=true&characterEncoding=utf8 ,when reverse chose table one by one. try

0

Remember that Hibernate is case sensitive, but Netbeans, when you use the "Hibernate configuration wizard", and the "Hibernate Reverse Engeenering" creates de files with the database name in lowcase. If you change both files (xxxxxxx.cfg.xml and xxxxxxx.reveng.xml) I think it will work fine.

Regards

0

In the File "hibernate.reveng.xml" delete the match-schema="mybd" clause

  <schema-selection match-catalog="mybd" match-schema="mybd"/>

Tested on netbeans 8.2 linux

src here

Pipo
  • 4,653
  • 38
  • 47