JPA报错:Correct the classpath of your application so that it contains a single

看了你的工程,修改几个地方

1,删除依赖

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>2.4.8</version>
        </dependency>

2,添加依赖

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>

3,main方法添加注解

你没有添加 @EnableJpaRepositories这个注解

@EnableJpaRepositories(basePackages = { "com.toy.start.repository" })		// 开启JPA,指定Repository的包
@EnableJpaAuditing
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
public class BootJpaStarterApplication {

    public static void main(String[] args) {
        SpringApplication.run(BootJpaStarterApplication.class, args);
    }

}

4,修改DesignRepository的查询语句

默认@Query用的是HQL,HQL不能用 * 会异常。

@Query(value =
        "SELECT * from  order  left join design on order.design_id = design.id WHERE order.order_num = ?1")
    List<Tuple> findByOrderNum(String orderNum);

原生查询,需要把nativeQuery设置为 true

@Query(value =
        "SELECT * from  order  left join design on order.design_id = design.id WHERE order.order_num = ?1", nativeQuery = true)
    List<Tuple> findByOrderNum(String orderNum);