第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 JPA 插件找不到 SeedStack“persistence.xml”

使用 JPA 插件找不到 SeedStack“persistence.xml”

九州編程 2023-03-31 09:37:24
我正在設(shè)置一個 SeedStack 批處理應(yīng)用程序,我正在嘗試使用不帶 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此外,當(dāng)我添加 persistence.xml 時,將創(chuàng)建 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 一起使用,而不必執(zhí)行 persistence.xml。
查看完整描述

1 回答

?
翻過高山走不出你

TA貢獻1875條經(jīng)驗 獲得超3個贊

查看此處的示例,您的 SeedStack JPA 配置缺少對數(shù)據(jù)源的引用:

????jpa:
?????units:
???????myUnit:
?????????datasource:?myDatasource
?????????properties:
???????????hibernate.dialect:?org.hibernate.dialect.PostgreSQLDialect
???????????hibernate.hbm2ddl.auto:?update

屬性的缺失或存在datasource是使 SeedStack 在persistence.xml基于配置或不基于配置之間進行選擇的原因(但這并不明顯)。

此外,“No spring entitymanager”異常讓我認(rèn)為您已經(jīng)配置了 SeedStack 讓 Spring 管理 JPA 事務(wù)(使用spring.manageJpa配置屬性)。如果是這樣,則它與您的 SeedStack JPA 設(shè)置相矛盾。

在 SeedStack/Spring 批處理中,您可以選擇:

  • 讓 SeedStack 管理 JPA。在這種情況下,您使用 SeedStack 配置 JPA 并僅在 SeedStack 管理的代碼(業(yè)務(wù)服務(wù)、存儲庫等)中使用 JPA(包括 @Transactional 注釋)。

  • 讓 Spring 管理 JPA。在那種情況下,您使用 Spring 配置 JPA(沒有任何 SeedStack 配置)并設(shè)置spring.manageJpa為 true。這將允許 SeedStack 管理的代碼使用 Spring 配置的 JPA 事務(wù)管理器。

讓 Spring 管理 JPA 在 Spring 批處理作業(yè)期間提供更好的性能,因此我推薦第二個選項(但僅適用于批處理作業(yè))。


查看完整回答
反對 回復(fù) 2023-03-31
  • 1 回答
  • 0 關(guān)注
  • 157 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號