gpt4 book ai didi

java - 异常,表未映射

转载 作者:行者123 更新时间:2023-11-29 23:26:34 24 4
gpt4 key购买 nike

当我在 mysql 提示符下运行命令时,它工作正常。

SELECT d.lastUpdatedDate,c.phoneNumber1,d.simImea1, d.simImea2,d.model,c.latitude,  c.longitude  from connectionDetails c inner join deviceDetails d  on (c.deviceUniqueIdentity = d.deviceUniqueIdentity AND d.rowStatus='0')

异常

Exception in thread "main" org.hibernate.hql.internal.ast.QuerySyntaxException: connectionDetails is not mapped [SELECT d.lastUpdatedDate,c.phoneNumber1,d.simImea1, d.simImea2,d.model,c.latitude,  c.longitude  from connectionDetails c inner join deviceDetails d  on (c.deviceUniqueIdentity = d.deviceUniqueIdentity AND d.rowStatus='0')]
at org.hibernate.hql.internal.ast.QuerySyntaxException.generateQueryException(QuerySyntaxException.java:96)
at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:120)

连接详细信息.hbm

<hibernate-mapping>
<class name="com.mypackage.CConnectionDetails"
table="connectionDetails">
<id name="connectionUniqueIdentity" type="java.lang.String">
<column name="connectionUniqueIdentity" />
<generator class="assigned" />

编辑:

Query query = currentSession().createSQLQuery(sql);

最佳答案

我更改了代码

Query query = currentSession().createSQLQuery(sql);

Query query = currentSession().createQuery(sql);

它成功了。

关于java - 异常,表未映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26907410/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com