The question is basically the same as below one:
JPA cascade persist and references to detached entities throws PersistentObjectException. Why?
I\'m creating
I have the same problem with a @EmbeddedId
and business data as part of the id.
The only way to know if the entity is new is performing a (em.find(entity)==null)?em.persist(entity):em.merge(entity)
but spring-data only provides save()
method and there is no way to fill the Persistable.isNew()
method with a find()
method.