【发布时间】:2015-05-09 00:28:39
【问题描述】:
我的工具:
- Netbeans 8.x
- 休眠插件
- 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
当我从数据库创建 Hibernate 映射文件和 Pojors 时,它创建了 2 个新闻对象:Application 和 User。但不是Userapp ...
我必须手动创建它吗?
这里是 hibernate.reveng.xml(奇怪的是,UserApp 是用黑色写的,而不是像 User 和 Application 那样用灰色写:
<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>
感谢您的帮助!!
【问题讨论】:
标签: java spring hibernate netbeans hql