The service that I create receives data from an external system that comes with the "external identifier" of the provider. When I save this data in our database, I also assign it an automatically generated identifier:
@Entity public class Content { @Id @GeneratedValue private Long id; private Long externalId;
When an external system sends data for the same content (with the same external ID), it is deserialized into separate POJO content:
Content c = deserialize(json);
Is there something like EntityManager.merge that can load and update the corresponding row from the database using the externalId field rather than the id field?
source share