0
我有問題,hql
我有3個表
1.用戶(USER_ID = PK,用戶名)
2.組(GROUP_ID = PK,組名)
3.用戶組(USER_ID = FK,GROUP_ID = FK)
org.hibernate.hql.internal.ast.QuerySyntaxException:路徑預期加入
<hibernate-mapping>
<class name="com.model.authRole.UserGroups" table="user_groups" catalog="db_realm" optimistic-lock="version">
<composite-id name="id" class="com.model.authRole.UserGroupsId">
<key-property name="userId" type="int">
<column name="user_id" />
</key-property>
<key-property name="groupId" type="int">
<column name="group_id" />
</key-property>
</composite-id>
<many-to-one name="groups" class="com.model.authRole.Groups" update="false" insert="false" fetch="select">
<column name="group_id" not-null="true" />
</many-to-one>
<many-to-one name="users" class="com.model.authRole.Users" update="false" insert="false" fetch="select">
<column name="user_id" not-null="true" />
</many-to-one>
<property name="aktiv" type="boolean">
<column name="aktiv" not-null="true" />
</property>
</class>
我想告訴用戶名和group_name
但錯誤從hql
from UserGroups ug
inner join Users u on u.user = ug.user_id
inner join Groups g on g.group = ug.group_id
,並記錄錯誤
org.hibernate.hql.internal.ast.QuerySyntaxException:路徑預期 的加入! [從com.model.authRole.UserGroups微克內加入 用戶U ON u.user = ug.user_id內上g.group加入組G = ug.group_id]
如何解決此問題?
請張貼的用戶和組級 – Ramesh