1
- Netbeans的8.x的
- Hibernate插件
- PHP我的管理
HQL查詢:
SELECT a.applicaitonName
FROM UserApp ua
LEFT JOIN Application a On ua.applicationId= a.applicationId
WHERE
ua.userId = 1
錯誤:
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)
我是如何進行的:
- 我創建的hibernate.cfg.xml
- 我創建hibernate.reveng.xml中
- 我創建Hibernate映射文件和Pojors來自數據庫
當我創建Hiber從數據庫映射文件和Pojors,它創建了2個新聞對象:Application
和User
。但不是Userapp
...
我必須手動創建它嗎?
這裏hibernate.reveng.xml中(有什麼奇怪的,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>
感謝您的幫助!!