我的table上有一个低于udt的
productsinfo FROZEN<productsinfo>
这是productsinfo的udt模式
"owned_product_details" map<text, FROZEN<list<FROZEN<productdetails>>>>,
"available_product_details" map<text, FROZEN<list<FROZEN<productdetails>>>>
产品详细信息udt有一些文本字段
当我尝试使用java插入值时,它抛出了异常
java.lang.NullPointerException: at index 1
at com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:239)
at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:230)
at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:225)
at com.google.common.collect.ImmutableList.construct(ImmutableList.java:281)
at com.google.common.collect.ImmutableList.of(ImmutableList.java:85)
at com.datastax.driver.core.DataType.map(DataType.java:462)
at com.datastax.driver.core.DataType.map(DataType.java:475)
at org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentProperty.getDataTypeFor(BasicCassandraPersistentProperty.java:223)
at org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentProperty.findDataType(BasicCassandraPersistentProperty.java:186)
at org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentProperty.getDataType(BasicCassandraPersistentProperty.java:169)
at org.springframework.data.cassandra.core.mapping.CassandraMappingContext.getDataTypeWithUserTypeFactory(CassandraMappingContext.java:571)
at org.springframework.data.cassandra.core.mapping.CassandraMappingContext.getDataType(CassandraMappingContext.java:536)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getCodec(MappingCassandraConverter.java:151)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.writeUDTValue(MappingCassandraConverter.java:657)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:391)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getWriteValue(MappingCassandraConverter.java:822)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getWriteValue(MappingCassandraConverter.java:749)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.writeUpdateFromWrapper(MappingCassandraConverter.java:478)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:383)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:365)
at org.springframework.data.cassandra.core.QueryUtils.createUpdateQuery(QueryUtils.java:132)
at org.springframework.data.cassandra.core.CassandraTemplate.update(CassandraTemplate.java:584)
调试时我发现了这个
suppressedExceptions Collections$UnmodifiableRandomAccessList<E> (id=317)
下面是java中的实体类
@Column("productsinfo")
@CassandraType(type = DataType.Name.UDT, userTypeName = "productsinfo")
private ProductsInfo productsInfo;
@Column("owned_product_details")
@CassandraType(type = DataType.Name.MAP, typeArguments = { DataType.Name.TEXT, DataType.Name.LIST })
private Map<String, List<ProductDetails>> ownedProductDetails;
@Column("available_product_details")
@CassandraType(type = DataType.Name.MAP, typeArguments = { DataType.Name.TEXT, DataType.Name.LIST })
private Map<String, List<ProductDetails>> availableProductDetails;
1条答案
按热度按时间wbgh16ku1#
https://jira.spring.io/browse/datacass-651 修复了这个问题,你能在更新到某个版本>=2.2rc1后再试一次吗?