I'm trying to develop a web application in microservice architecture with Jhipster, Java and MongoDB. I have a relation between 2 entities (a Tested Feature has a Software Version). My problem is the Software Version entity is partially saved, uniquely its id is saved, and other fields are null. With log, I saw data from front are ok, in controller too. The problem appears after the MongoRepository saving method, other attributes are stored as null in the database, like the EntityReponse returned by the post method. To be clear, what Tested Feature I expect :
{
id: "123453",
name: "TestedFeatureTest",
description: "test",
productSoftwareVersion: {
id: "1234575",
name: "ProductSoftwareTest",
softwareVersion: "1.2.3",
product: "product1",
project: "project1",
countryCode: "FR"
}
}
What I really receive :
{
id: "123453",
name: "TestedFeatureTest",
description: "test",
productSoftwareVersion: {
id: "1234575",
name: null,
softwareVersion: null,
product: null,
project: null,
countryCode: null
}
}
Here is my entity:
@Document(collection = "tested_feature")
public class TestedFeature implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String id;
@Field("name")
private String name;
@Field("description")
private String description;
@DBRef(lazy = false)
@Field("productSoftwareVersion")
@JsonIgnoreProperties(value = { "testedFeatures", "datasetRecords" }, allowSetters = true)
private ProductSoftwareVersion productSoftwareVersion;
}
My repository:
@SuppressWarnings("unused")
@Repository
public interface TestedFeatureRepository extends MongoRepository<TestedFeature, String> {
List<TestedFeature> findByNameEndingWith(String regexp);
}
What can I do ? Thanks for helping.