可以跨名称空间进行SQL查询吗?

时间:2020-10-09 08:53:25

标签: sql odbc intersystems intersystems-iris

是否可以在不同名称空间中的表之间进行查询?

例如:

public class CarDO {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;
  @Column(nullable = false)
  @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
  private ZonedDateTime dateCreated = ZonedDateTime.now();
  @Column(nullable = false)
  private String licensePlate;
  @Column(nullable = false)
  private int seatCount;
  @Column(nullable = false)
  private Boolean convertible;
  @Column(nullable = false)
  private int rating;
  @Column(nullable = false)
  @Enumerated(EnumType.STRING)
  private EngineType engineType;
  @Column(nullable = false)
  private String manufacturer;
  @Column(nullable = false)
  private Boolean selected;
  @OneToOne(fetch = FetchType.EAGER)
  @JoinTable(name = "driver_with_car",
    joinColumns = {@JoinColumn(name = "car_id")},
    inverseJoinColumns = {@JoinColumn(name = "driver_id")})
  private DriverDO driver;

至少可以使用相同的ODBC连接获取表select A.TS as A_TS, B.TS as B_TS from ns1.schema.table as A left join ns2.schema.table as B on A.id = B.id A吗?据我所知,建立连接时已建立命名空间。

1 个答案:

答案 0 :(得分:2)

唯一的方法是使用名称空间,可以将包和全局映射添加到新的或现有的名称空间。因此,所需的表将可从一个名称空间一起获得。