Skip to content

@Field name not used for repository method #1247

Closed
@JesusTheHun

Description

@JesusTheHun

Still migrating our app to Spring Data Couchbase 4, we have the following situation :

@Document
@Data
public class Foo extends AbstractAuditingEntity<Foo> implements Serializable {
    @Field("some_prop")
    private String someProp;
}

@Repository
public interface FooRepository extends CouchbaseRepository<Foo, String> {
    List<Foo> findBySomeProp(String someProp);
}

When I call fooRepository.findBySomeProp(...) the result is an empty entity except for the id and the audit fields.
I dug down and I found out that ReactiveFindByQueryOperationSupport.all(...) assembled query is :

SELECT META(`acme`).id AS __id, META(`acme`).cas AS __cas, `prefix`, `someProp`, `revision`, `createdById`, `createdDate`, `lastModifiedById`, `lastModifiedDate` FROM `acme` WHERE `_class` = "acme.domain.Foo" AND `some_prop` = $1

As you can see the field is correct in the WHERE clause but not in the SELECT.
Therefore the returned object is mostly empty, all business properties are null.

Did we forget to configure something ? Native methods works well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions