gpt4 book ai didi

java-cassnadra object Frozen annotation for address map>>>,

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:08:06 26 4
gpt4 key购买 nike

我正在尝试将数据插入 Cassandra(2.1.9)我的 Java 对象有一个 UDT 列表的映射。在运行代码时,我收到有关 @Frozen 注释的错误。我正在使用 DataStax(2.1.9) 库。 http://docs.datastax.com/en/drivers/java/2.1/index.html?com/datastax/driver/mapping/annotations/FrozenValue.html

create table user{
name text,
addresses map<text, frozen<list<frozen<address>>>>,
}

我的 Java 类

public class User{
private String name;
@FrozenValue
private Map<String, List<AddressUDT>> addresses;
}

但是我得到以下错误

java.lang.IllegalArgumentException: Error while checking frozen types on field addresses of entity com.dante.data.model.User: expected AddressUDT to be frozen but was not frozen
at com.datastax.driver.mapping.AnnotationChecks.validateAnnotations(AnnotationChecks.java:73) ~[cassandra-driver-mapping-2.1.7.jar:na]
at com.datastax.driver.mapping.AnnotationParser.parseEntity(AnnotationParser.java:81) ~[cassandra-driver-mapping-2.1.7.jar:na]
at com.datastax.driver.mapping.MappingManager.getMapper(MappingManager.java:148) ~[cassandra-driver-mapping-2.1.7.jar:na]
at com.datastax.driver.mapping.MappingManager.mapper(MappingManager.java:105) ~[cassandra-driver-mapping-2.1.7.jar:na]
at com.dante.data.migration.dao.UserMigrationDao.insertUsersToCassandra(UserMigrationDao.java:389) ~[UserMigrationDao.class:na]
at com.dante.data.migration.service.impl.UserMigration.insertUsersToCassandra(UserMigration.java:32) ~[UserMigration.class:na]
at com.dante.data.migration.controller.DataMigrationController.migrateUserDetails(DataMigrationController.java:93) ~[DataMigrationController.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) [spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) [spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) [servlet-api.jar:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) [spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) [servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.44]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.44]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.44]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.44]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.44]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:6.0.44]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.44]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) [catalina.jar:6.0.44]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) [tomcat-coyote.jar:6.0.44]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620) [tomcat-coyote.jar:6.0.44]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) [tomcat-coyote.jar:6.0.44]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

请建议解决方案

最佳答案

@Frozen("map<text, frozen<list<frozen<AddressUDT>>>>")
private Map<String, List<AddressUDT>> addresses;

关于java-cassnadra object Frozen annotation for address map<text, frozen<list<frozen<address>>>>,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32762981/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com