UserType class missing from Cassandra 4.x driver

58 Views Asked by At

I'm using in my java 11 project and migrating the code related to cassandra database from 3.60 to 4.13.0.

<cassandra.driver.oss.version>4.13.0</cassandra.driver.oss.version>

            </dependency>-->
            <!-- Cassandra Driver -->
            <dependency>
                <groupId>com.datastax.oss</groupId>
                <artifactId>java-driver-core</artifactId>
                <version>${cassandra.driver.oss.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>

            <!-- OPTIONAL DEPENDENCIES -->
            <dependency>
                <groupId>com.datastax.oss</groupId>
                <artifactId>java-driver-query-builder</artifactId>
                <version>${cassandra.driver.oss.version}</version>
            </dependency>
            <dependency>
                <groupId>com.datastax.oss</groupId>
                <artifactId>java-driver-mapper-runtime</artifactId>
                <version>${cassandra.driver.oss.version}</version>
            </dependency>

I can see in 3.x there was a class:

import com.datastax.driver.core.UserType;

which seems not to exist any more in 4.x

Is there any substitute for that in 4.x? How can this be handled in 4.x?

I tried searching for this class and/or its substitute in 4.x but with no luck so far. Just pointing me to this should be enough for me.

1

There are 1 best solutions below

0
Madhavan On

As part of CEP-8, DataStax has donated the DataStax Java Driver for Apache Cassandra® to the Apache Software Foundation on Nov 7, 2023. Other language driver donations will be followed shortly.

Your new coordinates for the Java Driver will be,

<dependency>
  <groupId>org.apache.cassandra</groupId>
  <artifactId>java-driver-core</artifactId>
  <version>${driver.version}</version>
</dependency>

<dependency>
  <groupId>org.apache.cassandra</groupId>
  <artifactId>java-driver-query-builder</artifactId>
  <version>${driver.version}</version>
</dependency>

<dependency>
  <groupId>org.apache.cassandra</groupId>
  <artifactId>java-driver-mapper-runtime</artifactId>
  <version>${driver.version}</version>
</dependency>

with 4.18.0 being the latest version as of this writing, but always recommended to leverage the latest version from releases section of the project.

Having said the current state, UserDefinedType class for the 4.x series lives here & direct link to code is here. You could also take a look at this test class which showcases how to use this.

There is also this great example repository that showcases how 3.x and 4.x compare and how to implement it.

p/s The above repo still uses the com.datastax.oss groupId, but you get the concept/point of how to implement.

I hope this helps! Good luck, cheers!