繁体   English   中英

createQuery 时“来自意外”

[英]“from unexpected” when createQuery

我在 createQuery 时收到错误:

“来自”出乎意料

在此处输入图片说明

我的代码如下:

    @Override
    public Admin findByAdmin(Admin admin) {

        return (Admin) sessionFactory.getCurrentSession().
                createQuery("from Admin where admin_name=? and pwd=?").
                setParameter(0, admin.getAdminName()).
                setParameter(1, admin.getAdminPwd()).
                uniqueResult();

    }

在intelliJ idea中修复这个错误

右键单击Your Project ---> Framework support :勾选“休眠”

确定

我是新手,但有同样的错误。 修复的问题是在 Project Structure - Facets 下添加 Hibernate facet。

如果在项目结构设置( File --> Project Structure... --> Facets )中找不到Hibernate ,则转到File --> Settings --> Plugins并在搜索字段中输入Hibernate并验证插件是否为添加到 Intellij。 之后,您将在项目设置的Facets下找到它并添加支持。

就我而言,这对我有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM