JPA / Hibernate Console

Is anyone using the JPA / Hibernate console in 10.x?

I have a JPA/Hibernate project, datasources mapped etc., and I can happily run SQL queries against both my local dev HSQL DB as well as our production DB from within IDEA.
HQL completion/validation works inline in our data access layer HQL queries, and the table & column names are all completed, so clearly IDEA has a valid connection to the DBs and understands the entity mappings.

However, when I try and use the Hibernate console, I dont see any mappings.  Hibernate config works fine in all my unit tests, so there's nothing wrong there.

hql> from Role
java.lang.Throwable: org.hibernate.hql.ast.QuerySyntaxException: Role is not mapped [from Role]
    at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)
    at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111)
    at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93)
    at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:322)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
    at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
    at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
    at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
    at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
    at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
    at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
    at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
    at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
    at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)

In the JPA console, I get a little further - the various entities are visible in the JPA QL completion, but as soon as I run a simple query, I hit the following:

jpa-ql> from Role
java.lang.ClassNotFoundException: javax.persistence.PersistenceException (no security manager: RMI class loader disabled)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
    at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:225)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
    at $Proxy142.createEntityManagerFactory(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)


Plain SQL: (using the same datasource that the JPA and Hibernate consoles are using)
select count(*) from Role

15


Ever since this feature was introduced, Ive never had success with it - is it actually being used?

5 comments
Comment actions Permalink

Looks like an HQL console configuration bug.

Please create youtrack ticket with attached sample project to reproduce the problem.
This is the fastest way to get help ;)


On 20.12.2010 22:09, StanAccy wrote:

Is anyone using the JPA / Hibernate console in 10.x?

>

I have a JPA/Hibernate project, datasources mapped etc., and I can happily run SQL queries against both my local dev HSQL DB
as well as our production DB from within IDEA. HQL completion/validation works inline in our data access layer HQL queries,
and the table&  column names are all completed, so clearly IDEA has a valid connection to the DBs and understands the entity
mappings.

>

However, when I try and use the Hibernate console, I dont see any mappings.  Hibernate config works fine in all my unit
tests, so there's nothing wrong there.

>

hql>  from Role java.lang.Throwable: org.hibernate.hql.ast.QuerySyntaxException: Role is not mapped at
org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180) at
org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111) at
org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93) at
org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:322) at
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441) at
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) at
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733) at
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584) at
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) at
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244) at
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254) at
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185) at
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) at
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) at
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) at
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) at
org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)

>

In the JPA console, I get a little further - the various entities are visible in the JPA QL completion, but as soon as I run
a simple query, I hit the following:

>

jpa-ql>  from Role java.lang.ClassNotFoundException: javax.persistence.PersistenceException (no security manager: RMI class
loader disabled) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375) at
sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165) at
java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620) at
java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247) at
sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197) at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575) at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:225) at
sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) at
java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178) at
java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132) at
$Proxy142.createEntityManagerFactory(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at
java.lang.reflect.Method.invoke(Method.java:597)

>
>

Plain SQL: (using the same datasource that the JPA and Hibernate consoles are using) select count(*) from Role

>

15

>
>

Ever since this feature was introduced, Ive never had success with it - is it actually being used?

>

--- Original message URL: http://devnet.jetbrains.net/message/5281337#5281337


0
Comment actions Permalink

Having the same problem with the JPA Console. When I execute a jpql-query I get the

java.lang.ClassNotFoundException: javax.persistence.PersistenceException (no security manager: RMI class loader disabled)
...
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
 at $Proxy110.createEntityManagerFactory(Unknown Source)
...
at java.lang.reflect.Method.invoke(Method.java:597)



I created the project from a maven pom with

        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
        </dependency>

as a dependency of the module. The PersistenceException is there, so I do not understand why the jpa-console is complaining about it.

Any hints??

Thx

Martijn
0
Comment actions Permalink

Hi,

Any workaround to this as this is my USP to Version 10 :-)

Many Thanks,

Ian.

0
Comment actions Permalink

Any solution yet? Experiencing the same problem with IntelliJ 10.:(

So funny, I also encountered the problem when trying to use JQL on our 'Role' object

jpa-ql> from Role
java.lang.ClassNotFoundException: javax.persistence.PersistenceException (no security manager: RMI class loader disabled)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
    at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:225)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
    at $Proxy152.createEntityManagerFactory(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)

0
Comment actions Permalink

Same problem here. configured data source, associated jpa facet to use data source and error is:

jpa-ql> FROM User u
java.lang.ClassNotFoundException: javax.persistence.PersistenceException (no security manager: RMI class loader disabled)
 at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
 at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
 at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
 at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
 at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
 at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
 at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
 at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
 at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
 at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:225)
 at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
 at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
 at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
 at $Proxy148.createEntityManagerFactory(Unknown Source)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)

0

Please sign in to leave a comment.