No property xxx found for type xxx!

一个系统中用到多数据源,一个mysql,一个oracle。且都用到mybatis 和 hibernete

配置类如下:

@Configuration
//配置mybatis 要扫描到的目录
@MapperScan(basePackages = "com.executor.jingfen.download.dao.mysql.brick.service.home.construct", sqlSessionTemplateRef = "brickServiceHomeConstructSqlSessionTemplate")
//配置hibernete要扫描到的目录
@EnableJpaRepositories(basePackages = {"com.executor.jingfen.download.repository.mysql.brick.service.home.construct"}, entityManagerFactoryRef = "brickServiceHomeConstructJpaEntityManagerFactory", transactionManagerRef = "brickServiceHomeConstructJpaTransactionManager")
public DataSourceMysqlConfig{
......
}



@Configuration
@MapperScan(
        basePackages = "comexecutor.jingfen.download.dao",
        sqlSessionTemplateRef = "xxlJobExecutorIomSqlSessionTemplate")
@EnableJpaRepositories(
        basePackages = {"comexecutor.jingfen.download.repository.iom"},
        entityManagerFactoryRef = "oracleIomJpaEntityManagerFactory",
        transactionManagerRef = "iomJpaTransactionManager")
public class DataSourceOracleConfig {

是因为我写错目录位置导致的
我在目录comexecutor.jingfen.download.repository.iom里面的类 用了mybatis的注解 @Insert,
这个目录是配置给jpa扫描的,mybatis没有来扫描。
insertBat 是我的dao方法名,BHomeConstructUserPortraitRepository 是查数据库返回的实体类。
报错内容是它把insertBat 识别为 BHomeConstructUserPortraitRepository 是一个属性。

报错内容

 Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract int com.iwhalecloud.gx.oss.job.executor.jingfen.download.repository.iom.BHomeConstructUserPortraitRepository.insertBat(java.util.List)! No property insertBat found for type BHomeConstructUserPortrait!
	

在mybatis配置扫描的目录去写就可以了。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值