1.连表查询时,from后的表要用()包起来
@Query(value = "SELECT b.cp01,b.ar01,b.cp02,b.cp03,b.cp04,b.cp05,a.bn10,a.bn11 from **(tb_cupboard as a, tb_config as b)** where a.bn01=b.cp01",nativeQuery = true)
2.不要为查询字段起别名
spring data jpa遇到的问题一.连表查询1.连表查询时,from后的表要用()包起来 @Query(value = "SELECT b.cp01,b.ar01,b.cp02,b.cp03,b.cp04,b.cp05,a.bn10,a.bn11 from **(tb_cupboard as a, tb_config as b)** where a.bn01=b.cp01",nativeQuery = true) 2.不要为查询字段起别名二.实体类1.当查询出来的数据包含两张表