Datastax java driver 3.0.0 Enumerated annotation not found

China☆狼群 提交于 2019-12-06 03:02:04

It looks like support for @Enumerated has been removed. Now, enums support is provided by the codecs in drivers-extras. Check out these two tickets for addtional info: JAVA-605 and JAVA-846.

An example of what your enums code might look like is:

[Use] EnumOrdinalCodec and EnumNameCodec:

 java    
 enum Foo {...}
 enum Bar {...}

 // register the appropriate codecs
 CodecRegistry.DEFAULT_INSTANCE
     .register(new EnumOrdinalCodec<Foo>(Foo.class))
     .register(new EnumNameCodec<Bar>(Bar.class))

 // the following mappings are handled out-of-the-box
 @Table
 public class MyPojo {
     private Foo foo;
     private List<Bar> bars;
     ...
 }

We are in the process of fixing the documentation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!