Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Couchbase的Spring数据-java.lang.IllegalArgumentException:不支持JsonArray的类型:_Json_Spring Boot_Spring Data Jpa_Spring Data Couchbase_Couchbase Java Api - Fatal编程技术网

Couchbase的Spring数据-java.lang.IllegalArgumentException:不支持JsonArray的类型:

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("#

我有一个SpringBoot 2应用程序,它使用Couchbase作为数据库,SpringBoot和SpringData,以及Lombok fot的getter和equals方法 我已经创建了这个存储库

@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);