开发者

org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.hql.classic.ClassicQueryTransactionFactory

开发者 https://www.devze.com 2023-02-22 14:55 出处:网络
why this exception is occure when i run query from hql editor org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.hql.classic.ClassicQueryTransactionFactory

why this exception is occure when i run query from hql editor

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:2009)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
    at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:264)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    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)
    ... 7 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.hql.classic.ClassicQueryTransactionFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.开发者_StackOverflow中文版ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:262)
    ... 13 more


I had the same exception when moved from hibernate 3 to hibernate 4 but when I tried to change the

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

with

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

it worked for me. I hope that help you.


There is minor change in new APIS. pls replace property value with

org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory.

NOTE: there is new package called 'internal' hierarchy introduced.


The correct name of classic query translator factory is org.hibernate.hql.classic.ClassicQueryTransactorFactory, use it in properties instead of the incorrect one (org.hibernate.hql.classic.ClassicQueryTransactionFactory).


The correct name is

org.hibernate.hql.classic.ClassicQueryTranslactorFactory

Pls note that 'l' is missing in the previous comment.

0

精彩评论

暂无评论...
验证码 换一张
取 消