Sun Java System Application Server Platform Edition 9 Release Notes

EntityManager.find() erroneously throws an IllegalArgumentException

EntityManager.find() erroneously throws an IllegalArgumentException for an entity that is a subclass of another entity if the primary key class is defined by an @IdClass annotation. See https://glassfish.dev.java.net/issues/show_bug.cgi?id=595 for more information.

Solution

Use the class of the topmost superclass as the argument to the find() method, and cast the result to the subclass.