Hibernate console fails with AnnotationConfiguration instance is required
Having problems with HQL console in IDEA 12.1.2. Our hibernate configuration file if pretty big using a mix of older XML mapping resource and newer mapping class elements. But every query reports same error about a missing AnnotationConfiguration ? Any ideas?
hql> select count(*) from TOReportItem
java.lang.RuntimeException: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping />
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1692)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1554)
at com.intellij.hibernate.remote.impl.RemoteConfigurationImpl.configure(RemoteConfigurationImpl.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:160)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
at com.sun.proxy.$Proxy139.configure(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.execution.rmi.RemoteUtil$2$1$1.compute(RemoteUtil.java:104)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:165)
at com.intellij.execution.rmi.RemoteUtil$2$1.invoke(RemoteUtil.java:101)
at com.sun.proxy.$Proxy139.configure(Unknown Source)
at com.intellij.hibernate.engine.HibernateEngine.ensureInitialized(HibernateEngine.java:115)
at com.intellij.hibernate.engine.HibernateEngine.createQuery(HibernateEngine.java:143)
at com.intellij.jpa.engine.JpaEngineBase.executeQueryInner(JpaEngineBase.java:166)
at com.intellij.jpa.engine.JpaEngineBase.access$000(JpaEngineBase.java:44)
at com.intellij.jpa.engine.JpaEngineBase$2.run(JpaEngineBase.java:128)
at com.intellij.jpa.engine.JpaEngineBase$1.run(JpaEngineBase.java:95)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
NB: The mapping for TOReportItem is via class (XML) while ExecutionParameterListValues is a mapping class. This is Windows 7 with a local MySQL 5.1 instance.
请先登录再写评论。
It looks like Hibernate tries to verify all mapped classes, not only one referred in HQL.
Is AnnotationConfiguration in the module classpath?
Thanks,
Alexander.
You mean is hibernate-annotations-3.5.6-Final.jar in the module classpath. Yes it is, the integration tests work from IDEA.
But it is an Apache Ivy / IvyIDEA project would that make a difference to the HQL console?
Seems like IvyIDEA doesn't make a difference. Created a library for the hibernate & hibernate-annotation jars, added it before IvyIDEA dependencies. Stopped & restarted IDEA and still get the same error the next time I fire things up.
This is a regression, please file a bug report.
http://youtrack.jetbrains.com/issue/IDEA-107154