As given in the EJB 3 specification, if a PersistenceContext annotation is used on a EntityManager field, or a PersistenceUnit is used on a EntityManagerFactory field, OpenEJB injects the appropriate object. However, developers may want to want to leverage the additional methods provided by OpenJPA. Currently, if the annotated types are OpenJPAEntityManager or OpenJPAEntityManagerFactory, OpenEJB leaves the fields as null. To obtain OpenJPA types, developers must call the OpenJPAPersistence.cast() method, generally in a PostContruct annotated method. OpenEJB could detect that the annotated types are of OpenJPA and perform appropriate casting and injection.