Hibernate Code Generator does not generate anything
I am trying to develop a Wicket-based web applicatio开发者_运维问答n using Hibernate at the model layer with a Postgres DB.
I created all my tables manually and I am trying to reverse-engineer the code from the tables using the Hibernate code generator tool downloaded from http://www.hibernate.org.
I created hibernate.cfg.xml
and hibernate.reveng.xml
. Also, I am able to browse the tables from Hibernate's perspective.
When I run the code generator with exporter settings containing the options to generate Domain as well as hbm
files on a specified package, it generates nothing.
Environment used:
Eclipse 3.5 (Galileo) Postgres 8.3-604 Wicket 1.3 workbenchThe resolution is to setup your database with database and table names in lowercase, then autogeneration will work.
Also, when I faced with the same problem, I noticed that when you create database or table by pgAdmin III using query (not by wizards) then all your letters in Uppercase will become automatically in Lowercase.
All,
I have worked-around/resolved the problem myself.
The actual problem was with the Hibernate code generator tool [HibernateTools-3.2.4.GA-R200905070146-H18.zip] that does not generate hbm.xml and pojo's by reverse engg method for PostgreSQL DB.
I believe the tool does not have reverse engg support for postgresql DB.
Workaround/resolution
I changed my DB to MySql and i was able to generate the hbm.xml and pojo. I have tried the same with Eclipse 3.5 Galileo and Eclipse Europa versions.
Tips
I have found a way kind of to understand whether the tool has got support for the DB that you use.
Once a console configuration is created for your application, go to hibernate perspective and expand the DB. if you are able to view the columns of the DB then the tool has got the support to generate the code.
The reason being is that, for postgreSQL it was not listing the column of the tables when browsed from hibernate perspective.
Thanks for all those who viewed my post.
~ Jegan
精彩评论