This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Rev.Eng. wizard doesn't generate POJOs and HBMs | ||
---|---|---|---|
Product: | javaee | Reporter: | Jan Horvath <jhorvath> |
Component: | Hibernate | Assignee: | Petr Cyhelsky <cyhelsky> |
Status: | RESOLVED INVALID | ||
Severity: | blocker | CC: | kganfield, ksudhanshu, pjiricka, varungovil |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | 147797 | ||
Bug Blocks: | |||
Attachments: |
My Log File
my metrics file My UI gestures |
Description
Jan Horvath
2008-07-18 19:58:34 UTC
Hibernate Tools code from hibernate.org is not working well only with MySQL db. This works well with JavaDB and HSQLDB. Investigating why Hibernate Tools is failing for MySQL only.. Partial bug is fixed in http://hg.netbeans.org/main/rev/3f7a80c5548b. 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. *** Issue 145039 has been marked as a duplicate of this issue. *** *** Issue 138839 has been marked as a duplicate of this issue. *** 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) Honza, Can you please try PostgreSQL and confirm that annotations can be generated with Sakila. thanks. Fixed : http://hg.netbeans.org/main/rev/ee43236d7e7b Now mapping files can be generated using Reverse Engg. wizard. Also, Annotated POJOs can be generated without any issues as before. 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 path. 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 This also works with a MySQL user added database so my guess is this a Postgresql issue. I have filed a bug http://www.netbeans.org/issues/show_bug.cgi?id=147797 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 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 ? -Vadiraj How do I turn on my IDE log? If it is on by default then where do I grab it? Thanks Steve 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. -Vadiraj. Created attachment 70235 [details]
My Log File
Created attachment 70236 [details]
my metrics file
Created attachment 70237 [details]
My UI gestures
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. http://hg.netbeans.org/main/rev/2bc40b634f50 Verified with NetBeans IDE Dev (Build 200809220201) (for MySQL and PostgreSQL, JavaDB). Sorry, verified with NetBeans IDE Dev (Build 200809251401) (for MySQL and PostgreSQL, JavaDB). Works now for me as well. Thanks everyone - loving netbeans, the developers, and the community When i creating a pojo and hbm from MySQL 5.1 database table (With foreign key relationship) i am getting this. When i creating a pojo and hbm from MySQL 5.1 database table (With foreign key relationship) i am getting this. 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. 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. This occurred for me as well when I followed the instructions at http://netbeans.org/kb/docs/web/hibernate-webapp.html 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(SettingsFactory.java:391) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:222) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2005) at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40) at org.netbeans.modules.hibernate.wizards.HibernateCodeGenWizard.generateClasses(HibernateCodeGenWizard.java:328) at org.netbeans.modules.hibernate.wizards.HibernateCodeGenWizard.instantiate(HibernateCodeGenWizard.java:419) at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1019) at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:591) at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:412) at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:256) at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:168) at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1541) at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1498) at org.openide.WizardDescriptor.access$1700(WizardDescriptor.java:130) at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2069) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1957) 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(ProxyClassLoader.java:264) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100) at org.hibernate.cfg.SettingsFactory.createQueryTranslatorFactory(SettingsFactory.java:388) ... 16 more Caused by: java.lang.ClassNotFoundException: org.hibernate.hql.classic.ClassicQueryTransactionFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:262) ... 21 more Removing the hibernate.query.factory_class property setting from the hibernate.cfg.xml file caused the POJO's to be generated properly. |