Question

We have started using Cassandra with Astyanax for our persistence layer and have hit the brick wall.

DefaultEntityManager is not allowing me to have ColumnFamily with

The error message thrown by Astyanax: "The method withColumnFamily(ColumnFamily) in the type DefaultEntityManager.Builder is not applicable for the arguments (ColumnFamily"

We want to use TimeUUIDTypes as key so that they are unique and are ordered by time.

How else can I use UUIDs as key?

Was it helpful?

Solution

I finally understood why Astyanax was not allowing me ColumnFamily with . My mistake was that I was defining the EntityManager with parameters (Object, String) instead of (Object, UUID)

ColumnFamily<UUID, String> columnFamily = new ColumnFamily< UUID, String>(
    "Merchant",  // Column Family Name    
    StringSerializer.get(), //  Key Serializer
    StringSerializer.get());    //  Column Serializer

EntityManager<Merchant, UUID > entityPersister = new DefaultEntityManager.Builder<Merchant, UUID >()
    .withEntityType(Merchant.class)
    .withKeyspace(keyspace)
    .withColumnFamily(columnFamily)
    .build();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top