Skip to content

Criteria object not allowing to use field names with underscore in them #3601

Closed
@SubashL

Description

@SubashL

Hi,

Our current Spring Data MongoDB version is 2.0.5.RELEASE.

We are migrating to 3.1.5.

Below is the query we use to retrieve the data from the database

@Autowired
private MongoOperations mongoOperation;

query.addCriteria(Criteria.where("business_area").is(buName)
.andOperator(Criteria.where("onboard_status").exists(true)
.andOperator(Criteria.where("onboard_status").is("approve"))));

mongoOperation.find(query, ABC.class, "abc");

and these are the imports we use for the above classes.

import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

In 2.0.5.RELEASE this used to be working fine. We get the desired data. But in 3.1.5. version, we are getting the below error.

org.springframework.data.mapping.PropertyReferenceException: No property onboard found for type FluidApplication!

Below is the POJO definition for the above data.

`public class FluidApplication {

@Id
@JsonSerialize(using = ToStringSerializer.class)
private ObjectId id;
private String requestor_name;
private String requestor_email;
private String business_area;
private String onboard_status;
private String appType;

private String application_name;
private String application_type;
private String business_functionality;
private String service_critically;
private String business_impact;
private String golivedate;

} `

Please let us know how to solve this issue. We cannot use @column annotation above the fields as we have more fields of this kind in other collections and please let us know whether something has changed from 2.0.5.RELEASE to 3.1.5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: regressionA regression from a previous release

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions