相关疑难解决方法(0)

Intellij如何使用spring boot正确配置hql.现在我得到持久性QL查询被错误检查

所以我试图使用hibernate和jpa的自定义查询

@Transactional
public interface EstimateOptionsDao extends JpaRepository<EstimateOptions, Integer> {

    @Query("from estimateOptions options inner join options.company company inner join company.user user where user.name = :userName\n")
    EstimateOptions EstimateOptions(String userName);

}
Run Code Online (Sandbox Code Playgroud)

但是EstimateOptions给了我以下错误:

Can't resolve symbol 'EstimateOptions' less... (Ctrl+F1) 
This inspection controls whether the Persistence QL Queries are error-checked
Run Code Online (Sandbox Code Playgroud)

所以我发现这篇文章为什么Hibernate查询在IntelliJ中有编译错误?.

所以我添加了一个方面来测试这个:

现在我有这样的hibernate.cfg.xml:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="connection.url"/>
    <property name="connection.driver_class"/>
    <property name="connection.username"/>
    <property name="connection.password"/>
    <!-- DB schema will be updated if needed …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa intellij-idea

3
推荐指数
1
解决办法
3167
查看次数

标签 统计

hibernate ×1

intellij-idea ×1

java ×1

jpa ×1

spring ×1