Couchbase的Spring数据-java.lang.IllegalArgumentException:不支持JsonArray的类型:
我有一个SpringBoot 2应用程序,它使用Couchbase作为数据库,SpringBoot和SpringData,以及Lombok fot的getter和equals方法 我已经创建了这个存储库Couchbase的Spring数据-java.lang.IllegalArgumentException:不支持JsonArray的类型:,json,spring-boot,spring-data-jpa,spring-data-couchbase,couchbase-java-api,Json,Spring Boot,Spring Data Jpa,Spring Data Couchbase,Couchbase Java Api,我有一个SpringBoot 2应用程序,它使用Couchbase作为数据库,SpringBoot和SpringData,以及Lombok fot的getter和equals方法 我已经创建了这个存储库 @ViewIndexed(designDoc = "bendicionesDoc") public interface BenRepository extends CouchbaseRepository<BendicionesDoc, String> { @Query("#
@ViewIndexed(designDoc = "bendicionesDoc")
public interface BenRepository extends CouchbaseRepository<BendicionesDoc, String> {
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} AND ANY uuid IN data.identifier SATISFIES uuid = $1 END")
List<BendicionesDoc<Item>> findById(Identifier identifier);
}
及
但是,当我运行存储库查询时,出现以下错误:
java.lang.IllegalArgumentException: Unsupported type for JsonArray: class com.bendiciones.Identifier
标识符是一个对象,您不能简单地要求Couchbase比较N1QL中的对象 您的方法定义应该类似于:
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} AND ANY uuid IN data.identifier SATISFIES uuid.id = $1 END")
List<BendicionesDoc<Item>> findById(String id);
@Query(#{n1ql.selectEntity}其中#{{n1ql.filter}和data.identifier中的任何uuid满足uuid.id=$1 END”)
列表findById(字符串id);
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(NON_NULL)
@EqualsAndHashCode
public class Identifier {
private String id;
private MasterServant idContext;
private MasterServant idScope;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(NON_NULL)
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class MasterServant {
private String context;
@JsonValue
@EqualsAndHashCode.Include
private String value;
private Name valueDescription;
@JsonCreator
public MasterServant(String value) {
this.value = value;
}
}
java.lang.IllegalArgumentException: Unsupported type for JsonArray: class com.bendiciones.Identifier
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} AND ANY uuid IN data.identifier SATISFIES uuid.id = $1 END")
List<BendicionesDoc<Item>> findById(String id);