Question

How can I solve this problem? I don't understand the error!

The Exception:

    Caused by: javax.persistence.RollbackException: Exception [EclipseLink-7197] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Null or zero primary key encountered in unit of work clone [Entities.Employe[ matEmp=0 ]], primary key [0]. 

Here is my Code:

EntityTransaction et = em.getTransaction();
et.begin();
Employe e = em.find(Employe.class,mat);
e.setNp(np);
em.merge(e);
Was it helpful?

Solution

EclipseLink does not seem to like 0 as primary key.

You can specify that in persistence.xmlas desribed here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top