Is there a way to generate JPA entities with IntelliJ without a persistence.xml file? Or basically have IntelliJ recognize a persistance unit from Java Config? I have an existing (legacy) schema and the project is a rewrite, now using Java Config in Spring Boot. Per the Spring Boot docs, the persistence unit will be created by code:
@Bean
public LocalContainerEntityManagerFactoryBean customerEntityManagerFactory(
EntityManagerFactoryBuilder builder) {
return builder
.dataSource(dataSource())
.packages(com.abc.DomainThing.class)
.persistenceUnit("abc")
.build();
}
I solved this by having a persistence.xml in the project and not really used by code or checked in. It just makes the IDE happy and I can bind a datasource to it to get the DB schema help in JPA Entity classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With