I am facing a common but irritating problem in eclipseLink. I am just trying to run this query using eclipseLink:
List organizationUnitEntityList = entityManager.createQuery("select o from OrganizationUnitEntity o where o.unitId=?1").setParameter(1, userTypeDomain.getUnitId()).getResultList(); OrganizationUnitEntity organizationUnitEntity = organizationUnitEntityList.get(0);
// 1 is passed as parameter
OrganizationUnitEntity is :
public class OrganizationUnitEntity {
@Id
private int unitId;
private String unit;
getters and setters...
}
But the exception that I am getting is : Null or zero primary key encountered in unit of work clone
Now, as there is no null or 0 primary key in the database, why this one is coming??