boot spring 怎么执行hql_Intellij如何使用Spring Boot正确配置hql。现在我得到持久性QL查询已进行错误检查...

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

@Transactional

public interface EstimateOptionsDao extends JpaRepository {

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

EstimateOptions EstimateOptions(String userName);

}

但是,这EstimateOptions给了我以下错误:

Can't resolve symbol 'EstimateOptions' less... (Ctrl+F1)

This inspection controls whether the Persistence QL Queries are error-checked

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

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

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

/p>

"-//Hibernate/Hibernate Configuration DTD//EN"

"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

和弹簧配置是这样的:

spring.datasource.url=jdbc:mysql://localhost:3306/testdb

spring.datasource.username=root

spring.datasource.password=root

spring.datasource.driverClassName=com.mysql.jdbc.Driver

spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect

spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

但是,如果我使用intellij的Persistence Tool进行了如下简单查询:

hql>来自用户

它产生以下错误:

[2015-12-09 12:59:27] org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class []

[2015-12-09 12:59:27] java.lang.ClassNotFoundException:

.....

如您所见,我有点迷路…这些设置有什么问题?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值