Closed proincode closed 4 years ago
Performing a delete on an entity, fires following exception:
The attribute [id] of class [] is mapped to a primary key column in the database. Updates are not allowed.
public void delete(E entity) { if (entity.getClass().isAnnotationPresent(NonDeletable.class)) { throw new NonDeletableEntityException(entity); } else { this.getEntityManager().remove(this.manage(entity)); entity.setId((Comparable)null); } }
The exception is thrown at entity.setId((Comparable)null);
This is a bug in EclipseLink. You should actually pass an unmanaged instance into that method.
Performing a delete on an entity, fires following exception:
The attribute [id] of class [] is mapped to a primary key column in the database. Updates are not allowed.
public void delete(E entity) { if (entity.getClass().isAnnotationPresent(NonDeletable.class)) { throw new NonDeletableEntityException(entity); } else { this.getEntityManager().remove(this.manage(entity)); entity.setId((Comparable)null); } }
The exception is thrown at entity.setId((Comparable)null);