Cassandra - 用户定义的数据类型

时间:2014-11-04 19:35:03

标签: cassandra datastax datastax-java-driver

我尝试过Cassandra用户定义的数据类型example given by DataStax,我得到了以下异常 他们没有说明Address对象在这种情况下应该是什么样子。我已经定义了UDT类型,但它没有帮助 任何人都可以帮我解决一下Address类的问题吗?

java.lang.IllegalArgumentException: Cannot map unknown class com.att.opus.mytest.Address for field private com.att.opus.mytest.Address com.att.opus.mytest.Account.address
    at com.datastax.driver.mapping.ReflectionMapper.getSimpleType(ReflectionMapper.java:321)
    at com.datastax.driver.mapping.ReflectionMapper.extractType(ReflectionMapper.java:286)
    at com.datastax.driver.mapping.ReflectionMapper$LiteralMapper.<init>(ReflectionMapper.java:65)
    at com.datastax.driver.mapping.ReflectionMapper$LiteralMapper.<init>(ReflectionMapper.java:59)
    at com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:372)
    at com.datastax.driver.mapping.AnnotationParser.convert(AnnotationParser.java:154)
    at com.datastax.driver.mapping.AnnotationParser.parseEntity(AnnotationParser.java:103)
    at com.datastax.driver.mapping.MappingManager.getMapper(MappingManager.java:119)
    at com.datastax.driver.mapping.MappingManager.mapper(MappingManager.java:76)
    at com.att.opus.mytest.AccountMapper.test(AccountMapper.java:12)
    at com.att.poc.Main.accountTest(Main.java:53)
    at com.att.poc.Main.main(Main.java:40)

1 个答案:

答案 0 :(得分:-1)

不确定问题是否仍然存在,但似乎您的地址类应使用@UDT注释进行注释,如here所述