Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1.1
Mapping documents:
<hibernate-mapping
>
<class
name="com.shkco.adsr.security.domain.BasicUserAccount"
table="SCS_USER"
dynamic-update="true"
dynamic-insert="true"
>
:
:
<map
name="roles"
table="SCS_USER_ROLE"
lazy="true"
sort="unsorted"
cascade="none"
>
:
:
</class>
</hibernate-mapping>
<hibernate-mapping
>
<class
name="com.shkco.adsr.security.domain.BasicRole"
table="SCS_ROLE"
dynamic-update="true"
dynamic-insert="true"
>
:
<map
name="functions"
table="SCS_ROLE_FUNCTION"
lazy="true"
sort="unsorted"
cascade="none"
>
:
</class>
</hibernate-mapping>
<hibernate-mapping
>
<class
name="com.shkco.adsr.security.domain.Function"
table="SCS_FUNCTION"
dynamic-update="true"
dynamic-insert="true"
>
:
<map
name="guiPermissions"
table="SCS_FUNC_GUI_PERMISSION"
lazy="true"
sort="unsorted"
cascade="none"
>
<key
column="FUNC_ID"
>
</key>
<index
column="PERMISSION_KEY"
type="long"
/>
<many-to-many
class="com.shkco.adsr.security.domain.GuiPermission"
column="PERMISSION_ID"
outer-join="auto"
/>
</map>
:
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
select elements(ua.roles.functions.guiPermissions) from com.shkco.adsr.security.domain.BasicUserAccount ua where u
a.id = :pId
Full stack trace of any exception that occurs:
[#|2006-07-04T17:52:33.038+0800|INFO|sun-appserver-ee8.1|javax.enterprise.system.stream.out|_ThreadID=16;|ERROR or
g.hibernate.hql.PARSER (ErrorCounter.java:33) - illegal syntax near collection: functions
|#]
[#|2006-07-04T17:52:33.040+0800|WARNING|sun-appserver-ee8.1|javax.enterprise.system.stream.err|_ThreadID=16;|org.h
ibernate.QueryException: could not resolve property: guiPermissions of: com.shkco.adsr.security.domain.BasicRole [
select elements(ua.roles.functions.guiPermissions) from com.shkco.adsr.security.domain.BasicUserAccount ua where u
a.id = :pId]
at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.j
ava:43)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1265)
at org.hibernate.persister.collection.AbstractCollectionPersister.toType(AbstractCollectionPersister.java:
1255)
at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:279)
at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:372)
at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:539)
at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:221)
at org.hibernate.hql.ast.tree.DotNode.resolveInFunctionCall(DotNode.java:147)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:722)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunction(HqlSqlBaseWalker.java:2548)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:1976)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1821)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1392)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:553)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583)
at com.shkco.jaf.application.security.dao.hibernate.HibernateUserAccountDAO.getGuiPermissions(HibernateUse
rAccountDAO.java:537)
at com.shkco.jaf.application.security.service.provider.ejb.BasicSecurityServiceBean.getGuiPermissions(Basi
cSecurityServiceBean.java:240)
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:585)
at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:950)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
at $Proxy69.getGuiPermissions(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:585)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:
167)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(Unknown Source)
at com.shkco.jaf.application.security.service.provider.ejb._BasicSecurityServiceRemote_DynamicStub.getGuiP
ermissions(_BasicSecurityServiceRemote_DynamicStub.java)
at com.shkco.jaf.application.security.activity.SignOnActivity.perform(SignOnActivity.java:87)
Name and version of the database you are using:
Oracle 10g release 2
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: DEBUG
Problem: Hibernate cannot parse map of map HQL ==> "select elements(ua.roles.functions.guiPermissions) "
But it works on Hibernate 3.0