Spring Boot JPA CrudRepository用于不同的Oracle模式

时间:2019-05-08 20:31:56

标签: oracle spring-data-jpa

我正在开发Spring Boot应用程序,
应用程序运行正常,可以从数据库中读取数据。

//working fine on schema PRINTERS_SCHEMA
public interface PrinterRepository extends CrudRepository<PrinterInfo,String>{}

我的问题是如何从不同的oracle模式添加新的存储库读取?

//need this repository to read from EMPLOYEE_ SCHEMA   
public interface EmployeeRepository extends CrudRepository<EmployeeInfo,String>{}

1 个答案:

答案 0 :(得分:1)

当您使用2个不同的实体时,可以在实体类上指定架构:

col <- c("/abc/def/hdk/database/dbclient/ibm/DB2Client-V97FP02.v01/sqllib/lib64", "/abc/def/hdk/database/dbclient/ibm/DB2Client-V97FP02.v01/sqllib/misc", "azn/external/curl-7.52.1/linux_g44.exe", "store/software/ep/rpg/external/python27-2.7.1/lib")
regmatches(col, regexpr("[^/]+-(?:\\w+\\.v)?\\d+(?:\\.\\d+)*", col, perl=TRUE))
## => [1] "DB2Client-V97FP02.v01" "DB2Client-V97FP02.v01" "curl-7.52.1"           "python27-2.7.1"