nl.knowledgeplaza.util.jpa
Class EclipselinkUtil

java.lang.Object
  extended by nl.knowledgeplaza.util.jpa.JpaUtil
      extended by nl.knowledgeplaza.util.jpa.EclipselinkUtil

public class EclipselinkUtil
extends JpaUtil


Nested Class Summary
 
Nested classes/interfaces inherited from class nl.knowledgeplaza.util.jpa.JpaUtil
JpaUtil.JpaEntityInformation
 
Field Summary
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
EclipselinkUtil()
           
 
Method Summary
static org.eclipse.persistence.jpa.JpaEntityManager castToJpaEntityManager(javax.persistence.EntityManager entityManager)
          Cast to JpaEntityManager, but first see if this is the EntityManagerExtender proxy
static Number getNextSequenceNumberValue(javax.persistence.EntityManager entityManager, Class clazz)
          Allocate a new PK
static org.eclipse.persistence.sessions.Session getSession(javax.persistence.EntityManager entityManager)
          get Eclipselink's session from a generic entityManager This actually is quite trivial once you got a hold of Eclipselink's JpaEntityManager, but just to be convenient we're doing here for you.
static Object getSingleResultOrDefault(javax.persistence.Query lQuery, Object d)
          getSingleResult throws an exception if nothing is found.
static Object getSingleResultOrNull(javax.persistence.Query lQuery)
          getSingleResult throws an exception if nothing is found.
static org.eclipse.persistence.sessions.UnitOfWork getUnitOfWork(javax.persistence.EntityManager entityManager)
          get Eclipselink's UnitOfWork from a generic entityManager This actually is quite trivial once you got a hold of Eclipselink's JpaEntityManager, but just to be convenient we're doing here for you.
static void installEventListenerRouter(javax.persistence.EntityManagerFactory lEntityManagerFactory, List<Class> entityClasses)
          Install the EclipselinkDescriptorEventListenerRouter class as the Eclipselink event manager and forward to local methods
 
Methods inherited from class nl.knowledgeplaza.util.jpa.JpaUtil
clear, clear, clear2ndLevelCache, close, close, collectEntityClasses, getJdbcConnection, mergeImmediately, mergeImmediately, persistImmediately, persistImmediately, persistImmediately, persistImmediately, removeImmediately, removeImmediately, stripEntityManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

EclipselinkUtil

public EclipselinkUtil()
Method Detail

getSingleResultOrNull

public static Object getSingleResultOrNull(javax.persistence.Query lQuery)
getSingleResult throws an exception if nothing is found. The method returns null in that case.

Parameters:
lQuery -
Returns:

getSingleResultOrDefault

public static Object getSingleResultOrDefault(javax.persistence.Query lQuery,
                                              Object d)
getSingleResult throws an exception if nothing is found. The method returns the default in that case.

Parameters:
lQuery -
Returns:

castToJpaEntityManager

public static org.eclipse.persistence.jpa.JpaEntityManager castToJpaEntityManager(javax.persistence.EntityManager entityManager)
Cast to JpaEntityManager, but first see if this is the EntityManagerExtender proxy

Parameters:
entityManager -
Returns:

getSession

public static org.eclipse.persistence.sessions.Session getSession(javax.persistence.EntityManager entityManager)
get Eclipselink's session from a generic entityManager This actually is quite trivial once you got a hold of Eclipselink's JpaEntityManager, but just to be convenient we're doing here for you.

Parameters:
entityManager -
Returns:

getUnitOfWork

public static org.eclipse.persistence.sessions.UnitOfWork getUnitOfWork(javax.persistence.EntityManager entityManager)
get Eclipselink's UnitOfWork from a generic entityManager This actually is quite trivial once you got a hold of Eclipselink's JpaEntityManager, but just to be convenient we're doing here for you.

Parameters:
entityManager -
Returns:

getNextSequenceNumberValue

public static Number getNextSequenceNumberValue(javax.persistence.EntityManager entityManager,
                                                Class clazz)
Allocate a new PK

Parameters:
entityManager -
clazz -
Returns:

installEventListenerRouter

public static void installEventListenerRouter(javax.persistence.EntityManagerFactory lEntityManagerFactory,
                                              List<Class> entityClasses)
Install the EclipselinkDescriptorEventListenerRouter class as the Eclipselink event manager and forward to local methods



Copyright © 2011 KnowledgePlaza. All Rights Reserved.