aarti makkar
aarti makkar

Reputation: 11

How can we connect to Cassandra 4.x using Kundera?

We have been using Kundera library in our Java project for connecting to Cassandra database 3.11.11 . The library or jar file that we have been using is com.impetus.kundera.client.kundera-cassandra.3.13.jar Recently the DBA team in our project migrated DB to Cassandra 4.0.7 version. After migration ,we are not able to connect to the DB. We were using thrift client factory com.impetus.client.cassandra.thrift.ThriftClientFactory , port 9061 in persistence.xml.

We have also read in the documentation that Kundera doesn’t support Cassandra 4.x . https://github.com/Impetus/kundera/wiki/Datastores-Supported

Please help us in identifying the issue here. Please suggest any other alternative that we can use to connect Cassandra 4.x using Java application

Upvotes: 1

Views: 145

Answers (3)

Erick Ramirez
Erick Ramirez

Reputation: 16293

Thrift was deprecated in Cassandra about 8 years ago, replaced by CQL all the way back to 2011 (CASSANDRA-1703). Drivers based on the Thrift API were retired a long time including Nate McCall's Hector in 2015 and Netflix's Astyanax in 2016.

Cassandra 2.2 stopped using Thrift in 2015 (CASSANDRA-8358, CASSANDRA-9319) and Cassandra 4.0 completely removed Thrift in 2016 (CASSANDRA-11115).

If you read through Kundera's documentation, they added Cassandra Java driver support in 2014 (Kundera v2.11) so there's really no reason to continue using the Thrift client.

To use the Java driver in Kundera, add the Maven coordinates for the driver to your project. For example:

<dependency>
    <groupId>com.impetus.kundera.client</groupId>
    <artifactId>kundera-cassandra-ds-driver</artifactId>
    <version>3.13</version>
</dependency>

The instead of using ThriftClientFactory, configure your persistence unit to use the driver with:

    <property name="kundera.client.lookup.class"             
        value="com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory" />

The Java driver enables you to use CQL for CRUD operations in Kundera. For details, see Cassandra Java driver support using Kundera.

Finally, I'm going to echo the recommendation from everyone else. The Kundera library doesn't appear to be actively maintained with the last release going all the way back to June 2018.

We recommend that you migrate your application to using the Cassandra Java driver natively. Cheers!

Upvotes: 0

clunven
clunven

Reputation: 1685

Kundera seems no more supported with a last commit 5 years ago. It did not evolve with the Cassandra technology and as stated by Tibor the support of thrift is long gone.

The Datastax driver offers the object mapping you expect:

If you are interested in the Spring Data Cassandra:

Upvotes: 2

Thrift has been deprecated for a very long time and finally removed with version 4.0. For a Java application it is safe to use a recent version of DataStax Java-driver. Other than Thrift, the CQL based Java-driver does have an object mapper, so you probably don't want any other library to include to get JPA support. However, Spring-Data is fairly popular and also provides JPA style mapping to multiple back-ends including recent Apache Cassandra.

Upvotes: 2

Related Questions