0

So since 1.5, we can map UDT with @UserDefinedType. We are experiencing errors when trying to map one of these :

@UserDefinedType("criteria")
public class Criteria {

  @CassandraType(type = Name.VARCHAR)
  private String cle;

  @CassandraType(type = Name.VARCHAR)
  private String nom;

  @CassandraType(type = Name.VARCHAR)
  private String format;
}

We are getting this error at launch :

org.springframework.dao.InvalidDataAccessApiUsageException: Unknown type [class java.lang.String] for property [cle] in entity [com.laposte.ariane.udt.Critere]; only primitive types and Collections or Maps of primitive types are allowed

To avoid this, we removed @CassandraType annotations, but it doesn't seem right.

What's wrong with our mapping?

Chetan chadha
  • 558
  • 1
  • 4
  • 19
Chev
  • 13
  • 5

1 Answers1

3

DataStax' driver reports only Name.TEXT as primitive data type but not Name.VARCHAR via DataType.allPrimitiveTypes(). Spring Data Cassandra uses DataType.allPrimitiveTypes() to resolve name to type mappings. I filed a ticket to add explicit type mappings for these two.

See also:

mp911de
  • 17,546
  • 2
  • 55
  • 95