JPA 支援

Spring Integration 的 JPA(Java Persistence API)模組提供了使用 JPA 執行各種資料庫操作的元件。

專案需要此依賴項

  • Maven

  • Gradle

<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-jpa</artifactId>
    <version>7.0.0</version>
</dependency>
compile "org.springframework.integration:spring-integration-jpa:7.0.0"

JPA API 必須透過一些特定於供應商的實現(例如 Hibernate ORM 框架)來包含。

提供以下元件

這些元件可以透過向目標資料庫傳送和接收訊息來執行 selectcreateupdatedelete 操作。

JPA 入站通道介面卡允許您使用 JPA 輪詢和檢索(select)資料庫中的資料,而 JPA 出站通道介面卡允許您建立、更新和刪除實體。

您可以將 JPA 出站閘道器用於將實體持久化到資料庫,從而允許您繼續流程並執行進一步的下游元件。同樣,您可以使用出站閘道器從資料庫中檢索實體。

例如,您可以使用出站閘道器,該閘道器在其請求通道上接收一個以 userId 作為有效載荷的 Message,以查詢資料庫,檢索使用者實體,並將其傳遞到下游進行進一步處理。

識別這些語義差異,Spring Integration 提供了兩個獨立的 JPA 出站閘道器

  • 檢索出站閘道器

  • 更新出站閘道器

© . This site is unofficial and not affiliated with VMware.