The problem is as follows:
We have an entity:
@Entity public class Feedback { @Id @GeneratedValue(generator="token") private String id; @ManyToOne private Product product; private String message;
And we have a server endpoint that receives feedback from clients. Feedback received in multipart / form format, with fields:
ProductId - product identifier Message - feedback message Some other fields
To set Feedback.product, we need to load the Product object from JPA - this can take a lot of time and creates unnecessary queries.
Is it possible to save the object, but pass the product identifier instead of the product object? We need to somehow modify the INSERT request.
We use EclipseLink JPA with Spring and Vaadin.
source share