public class JPAPlugin extends PlayPlugin
Modifier and Type | Class and Description |
---|---|
class |
JPAPlugin.TransactionalFilter |
PlayPlugin.Filter<T>
Modifier and Type | Field and Description |
---|---|
static boolean |
autoTxs |
index
Constructor and Description |
---|
JPAPlugin() |
Modifier and Type | Method and Description |
---|---|
void |
afterFixtureLoad() |
void |
afterInvocation()
Called after an invocation.
|
java.lang.Object |
bind(RootParamNode rootParamNode,
java.lang.String name,
java.lang.Class clazz,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations)
Called when play need to bind a Java object from HTTP params.
|
java.lang.Object |
bindBean(RootParamNode rootParamNode,
java.lang.String name,
java.lang.Object bean)
Called when play need to bind an existing Java object from HTTP params.
|
static void |
closeTx(boolean rollback)
Deprecated.
see
JPA.rollbackTx(java.lang.String) and JPA.closeTx(java.lang.String) method |
static javax.persistence.EntityManager |
createEntityManager() |
javax.persistence.EntityManager |
em(java.lang.String key) |
void |
enhance(ApplicationClasses.ApplicationClass applicationClass)
Enhance this class
|
static java.lang.String |
getDefaultDialect(Configuration dbConfig,
java.lang.String driver) |
static java.lang.String |
getDefaultDialect(java.lang.String driver) |
PlayPlugin.Filter<java.lang.Object> |
getFilter()
Return the filter implementation for this plugin.
|
Model.Factory |
modelFactory(java.lang.Class<? extends Model> modelClass) |
protected javax.persistence.EntityManagerFactory |
newEntityManagerFactory(java.lang.String dbName,
Configuration dbConfig) |
void |
onApplicationStart()
Reads the configuration file and initialises required JPA EntityManagerFactories.
|
void |
onApplicationStop()
Called at application stop (and before each reloading) Time to shutdown stateful things.
|
protected PersistenceUnitInfoImpl |
persistenceUnitInfo(java.lang.String dbName,
Configuration dbConfig) |
protected java.util.Properties |
properties(java.lang.String dbName,
Configuration dbConfig) |
static void |
startTx(boolean readonly)
Deprecated.
see JPA startTx() method
|
addMimeTypes, addTemplateExtensions, afterActionInvocation, afterApplicationStart, beforeActionInvocation, beforeDetectingChanges, beforeInvocation, bind, bind, compareTo, compileAll, compileSources, detectChange, detectClassesChange, getFunctionalTests, getJsonStatus, getMessage, getStatus, getUnitTests, hasFilter, invocationFinally, loadTemplate, onActionInvocationFinally, onActionInvocationResult, onApplicationReady, onClassesChange, onConfigurationRead, onEvent, onInvocationException, onInvocationSuccess, onLoad, onRequestRouting, onRoutesLoaded, onTemplateCompilation, overrideTemplateSource, postEvent, rawInvocation, routeRequest, runTest, serveStatic, unBind, willBeValidated
public java.lang.Object bind(RootParamNode rootParamNode, java.lang.String name, java.lang.Class clazz, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations)
PlayPlugin
bind
in class PlayPlugin
rootParamNode
- parameters to bindname
- the name of the objectclazz
- the class of the object to bindtype
- typeannotations
- annotation on the objectpublic java.lang.Object bindBean(RootParamNode rootParamNode, java.lang.String name, java.lang.Object bean)
PlayPlugin
bindBean
in class PlayPlugin
rootParamNode
- parameters to bindname
- the name of the objectbean
- object to bindpublic void enhance(ApplicationClasses.ApplicationClass applicationClass) throws java.lang.Exception
PlayPlugin
enhance
in class PlayPlugin
applicationClass
- the class to enhancejava.lang.Exception
- if cannot enhance the classpublic javax.persistence.EntityManager em(java.lang.String key)
public void onApplicationStart()
onApplicationStart
in class PlayPlugin
protected javax.persistence.EntityManagerFactory newEntityManagerFactory(java.lang.String dbName, Configuration dbConfig)
protected PersistenceUnitInfoImpl persistenceUnitInfo(java.lang.String dbName, Configuration dbConfig)
protected java.util.Properties properties(java.lang.String dbName, Configuration dbConfig)
public static java.lang.String getDefaultDialect(java.lang.String driver)
public static java.lang.String getDefaultDialect(Configuration dbConfig, java.lang.String driver)
public void onApplicationStop()
PlayPlugin
onApplicationStop
in class PlayPlugin
public void afterFixtureLoad()
afterFixtureLoad
in class PlayPlugin
public void afterInvocation()
PlayPlugin
afterInvocation
in class PlayPlugin
public PlayPlugin.Filter<java.lang.Object> getFilter()
PlayPlugin
getFilter
in class PlayPlugin
public static javax.persistence.EntityManager createEntityManager()
@Deprecated public static void startTx(boolean readonly)
readonly
- true for a readonly transaction@Deprecated public static void closeTx(boolean rollback)
JPA.rollbackTx(java.lang.String)
and JPA.closeTx(java.lang.String)
methodrollback
- shall current transaction be committed (false) or cancelled (true)public Model.Factory modelFactory(java.lang.Class<? extends Model> modelClass)
modelFactory
in class PlayPlugin
modelClass
- class of the modelGuillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly