Java Code Examples for org.apache.openjpa.persistence.OpenJPAPersistence#cast()

The following examples show how to use org.apache.openjpa.persistence.OpenJPAPersistence#cast() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DaoHelper.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
public static <T> List<T> fillLazy(EntityManager em, Function<OpenJPAEntityManager, TypedQuery<T>> func, String...groups) {
	OpenJPAEntityManager oem = OpenJPAPersistence.cast(em);
	boolean qrce = oem.getFetchPlan().getQueryResultCacheEnabled();
	try {
		oem.getFetchPlan().setQueryResultCacheEnabled(false); //update in cache during update
		TypedQuery<T> q = func.apply(oem);
		@SuppressWarnings("unchecked")
		OpenJPAQuery<T> kq = OpenJPAPersistence.cast(q);
		kq.getFetchPlan().addFetchGroups(groups);
		return kq.getResultList();
	} finally {
		oem.getFetchPlan().setQueryResultCacheEnabled(qrce);
	}
}
 
Example 2
Source File: OpenJpaDialect.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the OpenJPA-specific variant of {@code EntityManager}.
 * @param em the generic {@code EntityManager} instance
 * @return the OpenJPA-specific variant of {@code EntityManager}
 */
protected OpenJPAEntityManager getOpenJPAEntityManager(EntityManager em) {
	return OpenJPAPersistence.cast(em);
}
 
Example 3
Source File: OpenJpaDialect.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Return the OpenJPA-specific variant of {@code EntityManager}.
 * @param em the generic {@code EntityManager} instance
 * @return the OpenJPA-specific variant of {@code EntityManager}
 */
protected OpenJPAEntityManager getOpenJPAEntityManager(EntityManager em) {
	return OpenJPAPersistence.cast(em);
}
 
Example 4
Source File: OpenJpaDialect.java    From syncope with Apache License 2.0 2 votes vote down vote up
/**
 * Return the OpenJPA-specific variant of {@code EntityManager}.
 *
 * @param em the generic {@code EntityManager} instance
 * @return the OpenJPA-specific variant of {@code EntityManager}
 */
protected static OpenJPAEntityManager getOpenJPAEntityManager(final EntityManager em) {
    return OpenJPAPersistence.cast(em);
}