отношение "schema.table" не существует
build.grade:
Код: Выделить всё
implementation 'org.hibernate:hibernate-spatial:5.6.15.Final'
testImplementation 'org.testcontainers:postgresql:1.19.7'
Код: Выделить всё
public class PostgresResource implements QuarkusTestResourceLifecycleManager {
static DockerImageName image = DockerImageName.parse("postgis/postgis:12-3.0")
.asCompatibleSubstituteFor("postgres");
static PostgreSQLContainer postgresContainer = new PostgreSQLContainer(image)
.withDatabaseName("somedbname")
.withUsername("somedbuser")
.withPassword("password");
@SneakyThrows
public static void dumpDb() {
postgresContainer.execInContainer(
"pg_dump",
"-U", "somedbuser",
"-w", "-Fc",
"-d", "somedbname",
"-f", "/tmp/backup"
);
}
@Override
public void stop() {
postgresContainer.close();
}
@SneakyThrows
public static void restoreDump() {
postgresContainer
.execInContainer("pg_restore",
"-U", "somedbuser", "--clean",
"-w", "--disable-triggers",
"--dbname=somedbname",
"/tmp/backup");
}
@Override
@SneakyThrows
public Map start() {
postgresContainer.start();
return Map.of(
"quarkus.datasource.jdbc.url", postgresContainer.getJdbcUrl(),
"quarkus.datasource.username", postgresContainer.getUsername(),
"quarkus.datasource.password", postgresContainer.getPassword()
);
}
}
Код: Выделить всё
quarkus.hibernate-orm.dialect=ch.myapp.application.settings.PostgisPG10CustomDialect
Код: Выделить всё
public class PostgisPG10CustomDialect extends PostgisPG10Dialect {
public PostgisPG10CustomDialect() {
super();
this.registerHibernateType(2003, ListArrayType.class.getName());
}
}
Код: Выделить всё
@Column(name = "polygon_coordinates")
private Polygon coordinates;
Код: Выделить всё
SQL Error: 0, SQLState: 42P01
ERROR: relation "shipment.shipment" does not exist
Position: 1065
SQL Error: 0, SQLState: 42P01
ERROR: relation "shipment.shipment" does not exist
Position: 1056
relation "shipment.shipment" does not exist
Error occurred while executing task for trigger %s
java.util.concurrent.CompletionException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:874)
at java.base/java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:887)
at java.base/java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2357)
at java.base/java.util.concurrent.CompletableFuture$MinimalStage.whenComplete(CompletableFuture.java:2948)
at io.quarkus.scheduler.common.runtime.DefaultInvoker.invoke(DefaultInvoker.java:24)
at io.quarkus.scheduler.common.runtime.StatusEmitterInvoker.invoke(StatusEmitterInvoker.java:35)
at io.quarkus.scheduler.common.runtime.SkipConcurrentExecutionInvoker.invoke(SkipConcurrentExecutionInvoker.java:37)
at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask.doInvoke(SimpleScheduler.java:333)
at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask$1.handle(SimpleScheduler.java:314)
at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask$1.handle(SimpleScheduler.java:310)
at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:581)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1589)
Подробнее здесь: https://stackoverflow.com/questions/782 ... -container