To start, I should mention we're trying to keep new databases decoupled to avoid creating a monolithic db in the future. In our legacy database, we have a table called eventstub
whose data I need to access from the new database. I'm using Postgres 9.6.3
, which allows the postgres_fdw
extension for creating foreign tables across servers. This much works. My current problem lies in the fact that Hibernate can't validate the existence of this foreign table. The exact error in question is:
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [eventstub]
I can query the foreign table from the new database and results come back without a problem. Since I am with the stack, I think it's wise to keep spring.jpa.hibernate.ddl-auto = validate
, due to the likelihood that I will make mistakes with my JPA associations. In my new database, I have a table, Event
, which I'm using to wrap new data as well as a reference to the primary key of the table in the legacy database, eventstub
. Here's how I've defined this relationship:
@NotNull
@OneToOne(targetEntity = EventStub.class)
@JoinTable(name = "eventstub", joinColumns = @JoinColumn(name = "ems_event", referencedColumnName = "id"))
private EventStub emsEvent;
When I change spring.jpa.hibernate.ddl-auto = none
, I have no problems. I can access the foreign table just fine. Does anyone know if it's possible to somehow exclude only this one table, so the rest of the schema may be validated?