Package de.xima.fc.jpa.manager
Class EMProvider
- java.lang.Object
-
- de.xima.fc.jpa.manager.EMProvider
-
public class EMProvider extends Object
-
-
Constructor Summary
Constructors Constructor Description EMProvider()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Boolean
closeEMF()
static Boolean
closeEMF(boolean suppressListener)
static void
closeEntityManager(javax.persistence.EntityManager em)
static javax.persistence.EntityManager
createNewEntityManager()
static void
fireCloseListener()
static void
fireInitListener()
static void
fireOpenListener()
static Set<IBaseNotificationListener>
getCloseListeners()
static Connection
getConnection()
static EDatenbankTyp
getCurrentDBTyp()
static DataSource
getDatasource()
static IEMFactory
getEMFactory()
static Set<IBaseNotificationListener>
getInitListeners()
static Set<IBaseNotificationListener>
getOpenListeners()
static void
initAfterMigration()
Re-initializes the EMProvider after a migration.static void
initBeforeMigration()
Initializes the EMProvider for migration.static void
initialize()
static void
markEntityForMigration(javax.persistence.EntityManager em, Object entity)
Marks the entity for migration.static void
openEMF()
static void
openEMF(boolean suppressListener)
static void
registerCloseListener(IBaseNotificationListener listener)
static void
registerInitListener(IBaseNotificationListener listener)
static void
registerOpenListener(IBaseNotificationListener listener)
static void
reloadFactory()
static void
reloadFactory(boolean suppressAllListener)
static void
reloadFactory(boolean suppressOpenListener, boolean suppressCloseListener)
static void
shutdown()
static boolean
testConnection()
Deprecated.useDatabaseMonitor.testConnection()
orDatabaseMonitor.isConnected()
instead
-
-
-
Method Detail
-
createNewEntityManager
public static javax.persistence.EntityManager createNewEntityManager()
-
closeEMF
public static Boolean closeEMF()
-
closeEMF
public static Boolean closeEMF(boolean suppressListener)
-
initBeforeMigration
public static void initBeforeMigration()
Initializes the EMProvider for migration. This method should be called before the migration starts. Migration refers to the process of changing the encryption key used for the application layer encryption.
-
initAfterMigration
public static void initAfterMigration()
Re-initializes the EMProvider after a migration. This method should be called after the migration finishes. Migration refers to the process of changing the encryption key used for the application layer encryption.
-
markEntityForMigration
public static void markEntityForMigration(javax.persistence.EntityManager em, Object entity)
Marks the entity for migration. Only one entity can be marked at a time. The marking is associated with the given entity manager session. The marking is bound to the lifetime of the session, i.e. it is removed when the session is closed.Implementation note: This is needed to convince hibernate to persist an entity to the database even though none of its fields have changed. We read the entity with the old encryption key and write it back with the new encryption key.
- Parameters:
em
- The entity manager representing the session.entity
- The class to mark for migration. Removes the marking when null.
-
openEMF
public static void openEMF()
-
openEMF
public static void openEMF(boolean suppressListener)
-
closeEntityManager
public static void closeEntityManager(javax.persistence.EntityManager em)
-
initialize
public static void initialize()
-
shutdown
public static void shutdown()
-
reloadFactory
public static void reloadFactory(boolean suppressOpenListener, boolean suppressCloseListener)
-
reloadFactory
public static void reloadFactory(boolean suppressAllListener)
-
reloadFactory
public static void reloadFactory()
-
getCurrentDBTyp
public static EDatenbankTyp getCurrentDBTyp()
-
getEMFactory
public static IEMFactory getEMFactory()
-
getOpenListeners
public static Set<IBaseNotificationListener> getOpenListeners()
-
registerOpenListener
public static void registerOpenListener(IBaseNotificationListener listener)
-
getCloseListeners
public static Set<IBaseNotificationListener> getCloseListeners()
-
registerCloseListener
public static void registerCloseListener(IBaseNotificationListener listener)
-
getInitListeners
public static Set<IBaseNotificationListener> getInitListeners()
-
registerInitListener
public static void registerInitListener(IBaseNotificationListener listener)
-
fireOpenListener
public static void fireOpenListener()
-
fireInitListener
public static void fireInitListener()
-
fireCloseListener
public static void fireCloseListener()
-
getDatasource
public static DataSource getDatasource()
-
getConnection
public static Connection getConnection() throws SQLException
- Throws:
SQLException
-
testConnection
@Deprecated public static boolean testConnection()
Deprecated.useDatabaseMonitor.testConnection()
orDatabaseMonitor.isConnected()
instead- Returns:
- boolean if the database connection is valid
-
-