我正在设置一个 SeedStack 批处理应用程序,我正在尝试使用不带 persistence.xml 的 JPA,而是使用自动 JPA 检测类。
但是,我有这些例外:
HHH000318: Could not find any META-INF/persistence.xml file in the classpath
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named myUnit
我在 application.yaml 中有这个属性:
# This configuration file can override main configuration for integration tests
jdbc:
datasources:
myDatasource:
provider: org.seedstack.jdbc.internal.datasource.HikariDataSourceProvider
url: jdbc:postgresql://localhost:5432/CNVT
user: postgres
password : admin
jpa:
units:
myUnit:
properties:
hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate.hbm2ddl.auto: update
classes:
org:
generated:
project:
domain:
model:
jpaUnit: myUnit
此外,当我添加 persistence.xml 时,将创建 JPA 单元:
o.h.e.t.j.p.i.JtaPlatformInitiator HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
org.seedstack.jpa.internal.JpaPlugin Creating JPA unit myUnit from persistence.xml
org.seedstack.jpa.internal.JpaPlugin Created 1 JPA unit(s)
但是,我有这个例外:
org.seedstack.seed.SeedException: [SPRING] No spring entitymanager
我想正确地将 JPA 与 SeedStack 一起使用,而不必执行 persistence.xml。
翻过高山走不出你
相关分类