Spring Data couchbase find by subdocument Element

186 Views Asked by At

I have this model:

public class Person {
@Id
String id;

@Field
Address address;

}
public class Address {
@Id
String id;

@Field
String contry;

//..

}

I Use this repositry with the N1QL query it's doesn't work.

@Collection("personn")
public interface PersonRepository  extends PagingAndSortingRepository<Person, String> {

    @Query("#{#n1ql.selectEntity} WHERE address.contry = $1 and #{#n1ql.filter}")
    Optional<Personne> findBycountry(String idrefupp);
   
}

This is the erreur:

com.couchbase.client.core.error.PlanningFailureException: The server failed planning the query

           at com.couchbase.client.core.io.netty.query.QueryChunkResponseParser.errorsToThrowable(QueryChunkResponseParser.java:137)

           at java.base/java.util.Optional.map(Optional.java:265)

           at com.couchbase.client.core.io.netty.query.QueryChunkResponseParser.error(QueryChunkResponseParser.java:118)

           at com.couchbase.client.core.io.netty.chunk.ChunkedMessageHandler.lambda$maybeCompleteResponseWithFailure$1(ChunkedMessageHandler.java:281)

           at java.base/java.util.Optional.orElseGet(Optional.java:369)
0

There are 0 best solutions below