Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 140811 - Rev.Eng. wizard doesn't generate POJOs and HBMs
Rev.Eng. wizard doesn't generate POJOs and HBMs
Product: javaee
Classification: Unclassified
Component: Hibernate
All All
: P2 with 1 vote (vote)
: 6.x
Assigned To: Petr Cyhelsky
: 138839 145039 (view as bug list)
Depends on: 147797
  Show dependency treegraph
Reported: 2008-07-18 19:58 UTC by Jan Horvath
Modified: 2011-03-24 22:38 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT

My Log File (426.85 KB, text/plain)
2008-09-22 19:33 UTC, scitronpousty
my metrics file (4.43 KB, text/plain)
2008-09-22 19:36 UTC, scitronpousty
My UI gestures (97.02 KB, text/plain)
2008-09-22 19:37 UTC, scitronpousty

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Horvath 2008-07-18 19:58:34 UTC
I've tested reverse engineering wizard with sakila[1] sample database which we can consider as a valid db schema. Only reveng file was create, no POJOs, no 

Comment 1 _ gowri 2008-07-18 20:04:59 UTC
Hibernate Tools code from is not working well only with MySQL db. This works well with JavaDB and HSQLDB.
Investigating why Hibernate Tools is failing for MySQL only..
Comment 2 _ gowri 2008-07-22 07:32:15 UTC
Partial bug is fixed in
Comment 3 _ gowri 2008-07-22 21:39:34 UTC
With the above fix, POJOs (with or without annotations) can be generated. There still seems to be a problem with
generating mapping files which I am investigating. Since there is a workaround for this to use annotated POJOs, I am
lowering the priority to 3. 
Comment 4 Jan Horvath 2008-09-03 12:37:55 UTC
*** Issue 145039 has been marked as a duplicate of this issue. ***
Comment 5 scitronpousty 2008-09-17 23:16:27 UTC
*** Issue 138839 has been marked as a duplicate of this issue. ***
Comment 6 scitronpousty 2008-09-17 23:22:15 UTC
This still doesn't work with PostgreSQL either using the nightly. 
I can't get it to work with annotations either. Can someone please tell me how I can help diagnose where this is going
wrong. On my machine this feature is not doing anything but making the reveng.xml file.
Extremely frustrating.

Product Version: NetBeans IDE Dev (Build 200809170201)
Java: 1.6.0_07; Java HotSpot(TM) Client VM 10.0-b23
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 7 Jayashri Visvanathan 2008-09-17 23:25:31 UTC
  Can you please try PostgreSQL and confirm that annotations can be generated with Sakila.
Comment 8 Vadiraj Deshpande 2008-09-18 22:12:05 UTC
Fixed :
Now mapping files can be generated using Reverse Engg. wizard.
Comment 9 Vadiraj Deshpande 2008-09-18 22:12:53 UTC
Also, Annotated POJOs can be generated without any issues as before.
Comment 10 scitronpousty 2008-09-21 07:04:15 UTC
Still not working for me. Here is the steps on followed on Win XP sp2, Java 6.latestButNot10, Netbeans9201401
Fresh .netbeans, .netbeans-derby and netbeansprojects folder
1. Add the db connection under server to my Postgresql database
2. Created a web project with only the hibernate libraries checked - used tomcat 6.0.18 and the server and j2ee5
At this point I get a hibernate.cfg.xml in the root src folder
3. Added the jdbc jar file to the project libraries - using the jdbc4 driver that ships with PostgreSQL. 
4. Right click on the source packages folder and select New -> Other and then choose Hibernate -> HIbernate Mapping
Files and POJOS from database
5. Leave all the defaults on the first page of the wizard which will put the reveng.xml file in src/java
6. I add all my tables on the next page of the wizard
7. Leave all the checkboxes alone and type in "data" for the packaged to create the files in
It creates the reveng.xml file but none of the other files are created. 
This feels like broken to me. Please let me know if I am doing anything wrong but it seems like I am following the right
Comment 11 scitronpousty 2008-09-21 07:11:51 UTC
Just so you know this works if I point it at a derby datasource that came with netbeans. 
So either this is an issue with usercreated datasources (on the server tab) or with just postgresql
Comment 12 scitronpousty 2008-09-21 08:05:56 UTC
This also works with a MySQL user added database so my guess is this a Postgresql issue. I have filed a bug
for the hibernate plugin wizard where it does not add the postgresql dialect to the hibernate.cfg.xml on creation.
Please test this with postgresql to make sure the fix works.
Thanks for all your help
Comment 13 Vadiraj Deshpande 2008-09-21 11:49:52 UTC
Thanks Steve for testing the fix. Mostly the root cause is because of #147797 (not having the right dialect). I will
test the fix with Postgresql and verify. Meanwhile, if you have the IDE logs, can you please attach to this issue ?

Comment 14 scitronpousty 2008-09-22 16:46:15 UTC
How do I turn on my IDE log? If it is on by default then where do I grab it?
Comment 15 Vadiraj Deshpande 2008-09-22 19:25:32 UTC
Hi Steven,
IDE log is stored in ${netbeans.home}/var/log/messages.log where ${netbeans.home} is the directory used by IDE to store data. You can find out the exact 
value of '${netbeans.home}' on the About box in the IDE (Help/About). By default, all development builds have the logs turned on.

Comment 16 scitronpousty 2008-09-22 19:33:38 UTC
Created attachment 70235 [details]
My Log File
Comment 17 scitronpousty 2008-09-22 19:36:51 UTC
Created attachment 70236 [details]
my metrics file
Comment 18 scitronpousty 2008-09-22 19:37:27 UTC
Created attachment 70237 [details]
My UI gestures
Comment 19 Vadiraj Deshpande 2008-09-24 09:54:06 UTC
Fixed Schema selection related issue in generated reveng.xml file. Schema generation now happens using <schema-selection> tags and not using <table-
filter> as it used to happen before. 
This fix applies to all databases including PostgreSQL with which this issue was re-opened.
Tested with PostgreSQL, MySQL, Oracle 10g and JavaDB, the reverse engg. process to generate annotated POJOs and/or mapping files.
Comment 20 Martin Fousek 2008-09-26 10:20:16 UTC
Verified with NetBeans IDE Dev (Build 200809220201) (for MySQL and PostgreSQL, JavaDB).
Comment 21 Martin Fousek 2008-09-26 10:21:50 UTC
Sorry, verified with NetBeans IDE Dev (Build 200809251401) (for MySQL and PostgreSQL, JavaDB).
Comment 22 scitronpousty 2008-10-12 07:19:09 UTC
Works now for me as well. Thanks everyone - loving netbeans, the developers, and the community
Comment 23 ksudhanshu 2009-08-04 02:27:05 UTC
When i creating a pojo and hbm from MySQL 5.1 database table (With foreign key relationship) i am getting this.
Comment 24 ksudhanshu 2009-08-04 02:27:47 UTC
When i creating a pojo and hbm from MySQL 5.1 database table (With foreign key relationship) i am getting this.
Comment 25 Petr Cyhelsky 2009-08-04 15:40:19 UTC
I'm not very sure, what is the nature of your problem as your description is too short but I tested generating POJOs and
HBMs nonetheless. Config:

Product Version: NetBeans IDE Dev (Build 090804)
Java: 1.6.0_0; OpenJDK Client VM 14.0-b08
System: Linux version 2.6.28-14-generic running on i386; UTF-8; en_US (nb)
Mysql:   Server version		5.1.31-1ubuntu2
sakila sample db

and everything seems to work fine (POJOs and HBMs were generated correctly).

=> INCOMPLETE If you encounter the problem again, please include more detailed description of the problem, IDE log and
some steps to reproduce the problem.
Comment 26 Michal Mocnak 2009-09-22 10:36:01 UTC
Without requested information for long time - INVALID. We can't do anything in this case. Reporter, please add requested information and reopen issue. 
Thanks in advance.
Comment 27 rweaver 2011-03-24 22:38:04 UTC
This occurred for me as well when I followed the instructions at that said to add the property hibernate.query.factory_class set to org.hibernate.hql.classic.ClassicQueryTranslatorFactory in the hibernate.cfg.xml file

Looking at my log file, there is an error (even though the class does appear to exist in the hibernate3.jar:

INFO [org.hibernate.cfg.SettingsFactory]: Query translator: org.hibernate.hql.classic.ClassicQueryTransactionFactory
SEVERE [org.openide.util.Exceptions]
org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.hql.classic.ClassicQueryTransactionFactory
	at org.hibernate.cfg.SettingsFactory.createQueryTranslatorFactory(
	at org.hibernate.cfg.SettingsFactory.buildSettings(
	at org.hibernate.cfg.Configuration.buildSettings(
	at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(
	at org.netbeans.modules.hibernate.wizards.HibernateCodeGenWizard.generateClasses(
	at org.netbeans.modules.hibernate.wizards.HibernateCodeGenWizard.instantiate(
	at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(
	at org.openide.loaders.TemplateWizard.handleInstantiate(
	at org.openide.loaders.TemplateWizard.instantiateNewObjects(
	at org.openide.loaders.TemplateWizardIterImpl.instantiate(
	at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(
	at org.openide.WizardDescriptor.callInstantiateOpen(
	at org.openide.WizardDescriptor.callInstantiate(
	at org.openide.WizardDescriptor.access$1700(
	at org.openide.WizardDescriptor$Listener$2$
	at org.openide.util.RequestProcessor$
	at org.openide.util.RequestProcessor$
Caused by: java.lang.ClassNotFoundException: org.hibernate.hql.classic.ClassicQueryTransactionFactory starting from ModuleCL@d20759b[org.netbeans.modules.hibernatelib] with possible defining loaders [ModuleCL@d20759b[org.netbeans.modules.hibernatelib]] and declared parents [ModuleCL@2af6a882[org.netbeans.libs.freemarker], ModuleCL@6070c38c[org.netbeans.libs.commons_logging]]
	at org.netbeans.ProxyClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(
	at org.hibernate.util.ReflectHelper.classForName(
	at org.hibernate.cfg.SettingsFactory.createQueryTranslatorFactory(
	... 16 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.hql.classic.ClassicQueryTransactionFactory
	at Method)
	at java.lang.ClassLoader.loadClass(
	at sun.misc.Launcher$AppClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	at org.netbeans.ProxyClassLoader.loadClass(
	... 21 more

Removing the hibernate.query.factory_class property setting from the hibernate.cfg.xml file caused the POJO's to be generated properly.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo