3.10.2. JPA Extensions
The following sections outline the runtime interfaces you can use to access OpenJPA-specific functionality from JPA. Each interface contains services and convenience methods missing from the JPA specification. OpenJPA strives to use the same naming conventions and API patterns as standard JPA methods in all extensions, so that OpenJPA extension APIs feel as much as possible like standard JPA.
You may have noticed the examples throughout this document using the OpenJPAPersistence.cast methods to cast from standard JPA interfaces to OpenJPA extended interfaces.
This is the recommended practice.
Some application server vendors may proxy OpenJPA’s JPA implementation, preventing a straight cast. OpenJPAPersistence's cast methods work around these proxies.
public static OpenJPAEntityManagerFactory cast(EntityManagerFactory emf);
public static OpenJPAEntityManager cast(EntityManager em);
public static OpenJPAQuery cast(Query q);
We provide additional information on the OpenJPAPersistence helper below.