【发布时间】:2019-12-01 10:34:02
【问题描述】:
我的 Spring Boot 项目有两个实体,一个是员工
@Entity
@Table(name = "Employees ",schema = "dbo")
public class Employees {
在 test1 数据库中,另一个是 Payroll
@Entity
@Table(name = "Payroll ",schema = "dbo")
public class Payroll {
在 test2 数据库中,在 application.properties 文件中我有
spring.datasource.url: jdbc:sqlserver://hostname.com;databaseName=test1
这里 jpa 正在查看 test1 数据库中的两个表,因为我在 spring.datasource.url 中给出了该表
我需要知道如何让 jpa 知道 Payroll 表在 test2 数据库中可用
在 SQL SERVER Manangement studio 中,我们将通过提供此 SQL 来做到这一点
select * from test2..Payroll
这样,即使我们在 test1 db 中,我们也可以访问 test2 db 中的表
【问题讨论】:
标签: sql-server hibernate spring-boot jpa