我的工具:
我有3张桌子:
Userapp
- >> - 多对多 - >> - Application
- >> - 多对多 - >> - SELECT a.applicaitonName
FROM Userapp ua
LEFT JOIN Application a On ua.applicationId= a.applicationId
WHERE
ua.userId = ?
用户有:
用户id
的userName
UserApp:
用户id
-applicationId
申请:
的applicationID
applicaitonName
HQL查询:
org.hibernate.hql.internal.ast.QuerySyntaxException: Userapp is not mapped [SELECT a.applicaitonName
FROM Userapp ua
LEFT JOIN Application a On ua.applicationId= a.applicationId
WHERE
ua.userId = 1]
at org.hibernate.hql.internal.ast.QuerySyntaxException.generateQueryException(QuerySyntaxException.java:96)
at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:120)
错误:
Application
我是如何进行的:
当我从数据库创建Hibernate Mapping Files和Pojors时,它创建了2个新闻对象:User
和Userapp
。但不是<hibernate-reverse-engineering>
<schema-selection match-catalog="allin"/>
<table-filter match-name="user"/>
<table-filter match-name="application"/>
<table-filter match-name="userapp"/>
</hibernate-reverse-engineering>
...
我必须手动创建吗?
这里是hibernate.reveng.xml:
{{1}}
感谢您的帮助!!