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.

Bug 192027 - Incorrect value for Hibernate Config Property hibernate.query.factory_class
Summary: Incorrect value for Hibernate Config Property hibernate.query.factory_class
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Hibernate (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
: 190297 190597 192026 192900 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-16 19:15 UTC by giorgo
Modified: 2011-03-01 16:56 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 173947


Attachments
stacktrace (2.77 KB, text/plain)
2010-11-16 19:15 UTC, giorgo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description giorgo 2010-11-16 19:15:43 UTC
This issue was reported manually by giorgo.
It already has 3 duplicates 


Build: NetBeans IDE 6.9.1 (Build 201011082200)
VM: Java HotSpot(TM) Client VM, 17.1-b03, Java(TM) SE Runtime Environment, 1.6.0_22-b04
OS: Windows 7

User Comments:
giorgo: i was trying to 
Creating the Hibernate Mapping Files and POJOs

You can use the Hibernate Mapping Files and POJOs from a Database wizard to generate files for you. The wizard can generate a POJO and a corresponding mapping file for each table that you select in the wizard. The mapping files are XML files that contain data about how the columns in the tables are mapped to the fields in the POJOs. You need to have the hibernate.reveng.xml and hibernate.cfg.xml files to use the wizard.

To create the POJOS and mapping files using a wizard, perform the following steps.

   1. Right-click the Source Packages node in the Projects window and choose New > Other to open the New File wizard.
   2. Select Hibernate Mapping Files and POJOs from a Database in the Hibernate category. Click Next.
   3. Ensure that the hibernate.cfg.xml and hibernate.reveng.xml files are selected in the drop down lists.
   4. Select JDK 5 Language Features under the General Settings options.
   5. Ensure that the Dom

giorgo: i was doing the hibernate example 

Creating the Hibernate Mapping Files and POJOs

You can use the Hibernate Mapping Files and POJOs from a Database wizard to generate files for you. The wizard can generate a POJO and a corresponding mapping file for each table that you select in the wizard. The mapping files are XML files that contain data about how the columns in the tables are mapped to the fields in the POJOs. You need to have the hibernate.reveng.xml and hibernate.cfg.xml files to use the wizard.

To create the POJOS and mapping files using a wizard, perform the following steps.

   1. Right-click the Source Packages node in the Projects window and choose New > Other to open the New File wizard.
   2. Select Hibernate Mapping Files and POJOs from a Database in the Hibernate category. Click Next.
   3. Ensure that the hibernate.cfg.xml and hibernate.reveng.xml files are selected in the drop down lists.
   4. Select JDK 5 Language Features under the General Settings options.
   5.




Stacktrace: 
java.lang.ClassNotFoundException: org.hibernate.hql.classic.ClassicQueryTransactionFactory
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(AccessController.java:0)
   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)
Comment 1 giorgo 2010-11-16 19:15:46 UTC
Created attachment 103018 [details]
stacktrace
Comment 2 bht 2010-11-18 06:23:23 UTC

*** This bug has been marked as a duplicate of bug 192026 ***
Comment 3 bht 2010-11-18 06:26:39 UTC
*** Bug 192026 has been marked as a duplicate of this bug. ***
Comment 4 bht 2010-11-18 06:31:43 UTC
http://netbeans.org/kb/docs/java/hibernate-java-se.html

When editing hibernate.cfg.xml with the designer editor, one value available from the list in Miscellaneous Properties is wrong:

    <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTransactionFactory</property>

This should probably be org.hibernate.hql.classic.ClassicQueryTranslatorFactory - the class ClassicQueryTransactionFactory is not found.

However, when using ClassicQueryTranslatorFactory, then the example in the tutorial fails with an error as described in:

http://netbeans.org/projects/usersguide/lists/nbdocs_feedback/archive/2010-10/message/44

The query works if one selects the value 

org.hibernate.hql.ast.ASTQueryTranslatorFactory
Comment 5 bht 2010-11-19 20:22:36 UTC
The excellent tutorial using this fails. This tutorial is a showcase of the ease of Hibernate development with NetBeans using wizards. With raising the priority of this to 1, I am trying to raise awareness of this.
Comment 6 Sergey Petrov 2010-11-19 20:53:51 UTC
"The query works if one selects the value 

org.hibernate.hql.ast.ASTQueryTranslatorFactory"

Does it mean it's a workaround? If it's it doesn't look like P1 and may be tutorial need correction.
Comment 7 bht 2010-11-20 01:48:08 UTC
org.hibernate.hql.ast.ASTQueryTranslatorFactory is a workaround, and the tutorial may need a correction to reflect that.

But that is only part of the problem.

NetBeans contains 

org.hibernate.hql.classic.ClassicQueryTransactionFactory

which I don't know what that is. It does not seem to exist.

If that is corrected to ClassicQueryTranslatorFactory, then im am not sure whether that is ok, but it looks logical. When used in the tutorial, then the tutorial still fails.

So the whole thing is quite tricky and confusing, not the type of thing that one would want to see in wizards/tutorials.

Sure not a priority one, but highly visible and damaging while easy to fix.
Comment 8 giorgo 2010-11-20 08:05:39 UTC
iI have spend hours  untill i realisead what is ..
I am trying the tut Using Hibernate in a Web Application   very good  but when it comes for 

8 .Type org.hibernate.hql.classic.ClassicQueryTranslatorFactory as the Property Value. Click OK.
Add Hibernate Property dialog box for properties hibernate.query.factory_class

If you click the XML tab in the editor you can see the file in XML view. Your file should look like the following (the three new properties are bold):

<hibernate-configuration>
    <session-factory name="session1">
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sakila</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">######</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.current_session_context_class">thread</property>
        <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
    </session-factory>
</hibernate-configuration>

with this entry        org.hibernate.hql.classic.ClassicQueryTranslatorFactory  
i canott create the  pojos with the wizard later on step 
 
Creating the Hibernate Mapping Files and POJOs

You can use the Hibernate Mapping Files and POJOs from a Database wizard to generate files for you. The wizard can generate a POJO and a corresponding mapping file for each table that you select in the wizard. The mapping files are XML files that contain data about how the columns in the tables are mapped to the fields in the POJOs. You need to have the hibernate.reveng.xml and hibernate.cfg.xml files to use the wizard.

To create the POJOS and mapping files using a wizard, perform the following steps.

   1. Right-click the Source Packages node in the Projects window and choose New > Other to open the New File wizard.
   2. Select Hibernate Mapping Files and POJOs from a Database in the Hibernate category. Click Next.
   3. Ensure that the hibernate.cfg.xml and hibernate.reveng.xml files are selected in the drop down lists.
   4. Select JDK 5 Language Features under the General Settings options.
   5. Ensure that the Domain Code and Hibernate XML Mappings options are selected.
   6. Select dvdrental for the Package name. Click Finish.

So if i go back on step 
8 .Type org.hibernate.hql.classic.ClassicQueryTranslatorFactory as the Property Value. Click OK.
Add Hibernate Property dialog box for properties hibernate.query.factory_class

and i change the org.hibernate.hql.classic.ClassicQueryTranslatorFactory  to 
org.hibernate.hql.ast.ASTQueryTranslatorFactory   later  i can  create the pojos with the wizard  ... 

THE SAME BUG IS ALSO ON NETBEANS 6.8 and 6.9.1
Comment 9 giorgo 2010-11-20 08:11:03 UTC
Yes but i don't know if the tut need correction!!!!!!!!!!
 i try to understand Hibernate . I am student and i just want to have this application work so that i can understand what is going on with hibernate.
Comment 10 Sergey Petrov 2010-11-20 12:16:32 UTC
Thanks for more information, let it be P2 for now, still more visible then most issues but do not block other activities.
Was here any reply to http://netbeans.org/projects/usersguide/lists/nbdocs_feedback/archive/2010-10/message/44 ?
Comment 11 Sergey Petrov 2010-11-26 15:09:09 UTC
What I see tutorial itself said about org.hibernate.hql.classic.ClassicQueryTranslatorFactory which one may be mixed with listed org.hibernate.hql.classic.ClassicQueryTransactionFactory as it's similar but it's not tutorial issue in case ClassicQueryTranslatorFactory works.
But as you said ClassicQueryTranslatorFactory fails at runtime, it's another issue and I'm not sure if it's nb or tutorial or specific setup issue.

Anyway I will remove org.hibernate.hql.classic.ClassicQueryTransactionFactory as almost all google links are related to nb issues, when org.hibernate.hql.classic.ClassicQueryTranslatorFactory point at hibernate site from the beginning it looks like a misprint affecting tutorial even tutorial said about correct class. It's unlikely ClassicQueryTranslatorFactory have a problem also as I hope tutorial was executed at least at creation time successfully.
Comment 12 Sergey Petrov 2010-11-26 15:19:09 UTC
<Incorrect value for Hibernate Config Property hibernate.query.factory_class > is fixed http://hg.netbeans.org/web-main/rev/08e9088bc877

next issue may need to be filed as separate one and investigated more if it's tutorial/hibernate/nb issue and how to resolve it.
Comment 13 bht 2010-11-26 20:47:09 UTC
Many thanks Sergey!

Created bug 192554 for the tutorials.
Comment 14 Quality Engineering 2010-11-27 06:26:27 UTC
Integrated into 'main-golden', will be available in build *201011270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/08e9088bc877
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #192027 fix factory name to one really existent
Comment 15 Sergey Petrov 2010-12-06 11:46:20 UTC
*** Bug 190297 has been marked as a duplicate of this bug. ***
Comment 16 Sergey Petrov 2010-12-06 13:06:18 UTC
*** Bug 192900 has been marked as a duplicate of this bug. ***
Comment 17 Sergey Petrov 2011-03-01 16:56:26 UTC
*** Bug 190597 has been marked as a duplicate of this bug. ***