Hibernate @ManyToOne references an unknown entity

前端 未结 12 1294
名媛妹妹
名媛妹妹 2021-01-03 17:54

I am receiving the following Hibernate Exception:

@OneToOne or @ManyToOne on Matchup.awayTeam references an unknown entity: Team

The simplified

12条回答
  •  时光说笑
    2021-01-03 17:58

    If you are using Spring Boot in combination with hibernate, then actually you may just need to add the package to your @EntityScan base package array.

    @SpringBootApplication(scanBasePackages = {"com.domain.foo.bar.*"})
    @EnableJpaRepositories(basePackages ={"com.domain.foo.bar.*"})
    @EntityScan(basePackages ={"com.domain.foo.bar.*", "com.domain.another.*"})
    public class SpringBootApplication extends SpringBootServletInitializer {
    }
    

提交回复
热议问题