Argument validation in find(), getReference(), detach(), contains(), remove()

find(cls, null) previously returned null, a primary key of the wrong type or a non-entity class surfaced later as an OpenJPA ArgumentException or a failed lookup, and removing a detached unenhanced entity could be silently ignored. These methods now validate their arguments as required by the specification and throw IllegalArgumentException (marking the transaction for rollback) for null keys, non-entity classes, primary keys of an incompatible type (numeric widening such as Integer to Long is accepted, narrowing is rejected), non-entities passed to detach()/contains(), and detached instances passed to remove(). getReference() throws EntityNotFoundException also for unenhanced entities.

Guard against null keys, pass keys of the declared @Id type and merge() detached instances before removing them. No compatibility option exists.