From aca934b972e342760a6cc4edd1033760dd8b8e67 Mon Sep 17 00:00:00 2001 From: Maxime Wiewiora <48218208+maximevw@users.noreply.github.com> Date: Thu, 7 Dec 2023 01:19:12 +0100 Subject: [PATCH] Fix issue #242 (#243) Cast the connection to JdbcConnection, then the underlying connection to CassandraConnection to retrieve the keyspace. --- .../liquibase/ext/cassandra/database/CassandraDatabase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/liquibase/ext/cassandra/database/CassandraDatabase.java b/src/main/java/liquibase/ext/cassandra/database/CassandraDatabase.java index 31d8606a..1f3c50f2 100644 --- a/src/main/java/liquibase/ext/cassandra/database/CassandraDatabase.java +++ b/src/main/java/liquibase/ext/cassandra/database/CassandraDatabase.java @@ -111,7 +111,10 @@ public String getCurrentDateTimeFunction() { public String getKeyspace() { if (keyspace == null) { try { - keyspace = ((CassandraConnection) (this).getConnection()).getSession().getKeyspace().toString(); + if (this.getConnection() instanceof JdbcConnection) { + keyspace = ((CassandraConnection) ((JdbcConnection) this.getConnection()) + .getUnderlyingConnection()).getSchema(); + } } catch (Exception e) { Scope.getCurrentScope().getLog(CassandraDatabase.class) .severe("Could not get keyspace from connection", e);