play.db.jpa
Class JPAPlugin

java.lang.Object
  extended by play.PlayPlugin
      extended by play.db.jpa.JPAPlugin
All Implemented Interfaces:
java.lang.Comparable<PlayPlugin>

public class JPAPlugin
extends PlayPlugin

JPA Plugin


Nested Class Summary
static class JPAPlugin.JPAModelLoader
           
 
Field Summary
static boolean autoTxs
           
 
Fields inherited from class play.PlayPlugin
index
 
Constructor Summary
JPAPlugin()
           
 
Method Summary
 void afterFixtureLoad()
           
 void afterInvocation()
          Called after an invocation.
 void beforeInvocation()
          Called before a Play! invocation.
 java.lang.Object bind(java.lang.String name, java.lang.Class clazz, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, java.util.Map<java.lang.String,java.lang.String[]> params)
          Called when play need to bind a Java object from HTTP params
 java.lang.Object bind(java.lang.String name, java.lang.Object o, java.util.Map<java.lang.String,java.lang.String[]> params)
          Called when play need to bind an existing Java object from HTTP params
static void closeTx(boolean rollback)
          clear current JPA context and transaction
 void enhance(ApplicationClasses.ApplicationClass applicationClass)
          Enhance this class
 void invocationFinally()
          Called at the end of the invocation.
 Model.Factory modelFactory(java.lang.Class<? extends Model> modelClass)
           
 void onApplicationStart()
          Called at application start (and at each reloading) Time to start stateful things.
 void onApplicationStop()
          Called at application stop (and before each reloading) Time to shutdown stateful things.
 void onInvocationException(java.lang.Throwable e)
          Called if an exception occured during the invocation.
static void startTx(boolean readonly)
          initialize the JPA context and starts a JPA transaction
 
Methods inherited from class play.PlayPlugin
addMimeTypes, addTemplateExtensions, afterActionInvocation, afterApplicationStart, beforeActionInvocation, beforeDetectingChanges, compareTo, compileAll, compileSources, detectChange, detectClassesChange, getJsonStatus, getMessage, getStatus, loadTemplate, onActionInvocationResult, onApplicationReady, onClassesChange, onConfigurationRead, onEvent, onInvocationSuccess, onLoad, onRequestRouting, onRoutesLoaded, onTemplateCompilation, overrideTemplateSource, postEvent, rawInvocation, routeRequest, runTest, serveStatic, unBind, willBeValidated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

autoTxs

public static boolean autoTxs
Constructor Detail

JPAPlugin

public JPAPlugin()
Method Detail

bind

public java.lang.Object bind(java.lang.String name,
                             java.lang.Class clazz,
                             java.lang.reflect.Type type,
                             java.lang.annotation.Annotation[] annotations,
                             java.util.Map<java.lang.String,java.lang.String[]> params)
Description copied from class: PlayPlugin
Called when play need to bind a Java object from HTTP params

Overrides:
bind in class PlayPlugin

bind

public java.lang.Object bind(java.lang.String name,
                             java.lang.Object o,
                             java.util.Map<java.lang.String,java.lang.String[]> params)
Description copied from class: PlayPlugin
Called when play need to bind an existing Java object from HTTP params

Overrides:
bind in class PlayPlugin

enhance

public void enhance(ApplicationClasses.ApplicationClass applicationClass)
             throws java.lang.Exception
Description copied from class: PlayPlugin
Enhance this class

Overrides:
enhance in class PlayPlugin
Throws:
java.lang.Exception

onApplicationStart

public void onApplicationStart()
Description copied from class: PlayPlugin
Called at application start (and at each reloading) Time to start stateful things.

Overrides:
onApplicationStart in class PlayPlugin

onApplicationStop

public void onApplicationStop()
Description copied from class: PlayPlugin
Called at application stop (and before each reloading) Time to shutdown stateful things.

Overrides:
onApplicationStop in class PlayPlugin

beforeInvocation

public void beforeInvocation()
Description copied from class: PlayPlugin
Called before a Play! invocation. Time to prepare request specific things.

Overrides:
beforeInvocation in class PlayPlugin

afterInvocation

public void afterInvocation()
Description copied from class: PlayPlugin
Called after an invocation. (unless an excetion has been thrown). Time to close request specific things.

Overrides:
afterInvocation in class PlayPlugin

onInvocationException

public void onInvocationException(java.lang.Throwable e)
Description copied from class: PlayPlugin
Called if an exception occured during the invocation.

Overrides:
onInvocationException in class PlayPlugin
Parameters:
e - The catched exception.

invocationFinally

public void invocationFinally()
Description copied from class: PlayPlugin
Called at the end of the invocation. (even if an exception occured). Time to close request specific things.

Overrides:
invocationFinally in class PlayPlugin

startTx

public static void startTx(boolean readonly)
initialize the JPA context and starts a JPA transaction

Parameters:
readonly - true for a readonly transaction
autoCommit - true to automatically commit the DB transaction after each JPA statement

closeTx

public static void closeTx(boolean rollback)
clear current JPA context and transaction

Parameters:
rollback - shall current transaction be committed (false) or cancelled (true)

modelFactory

public Model.Factory modelFactory(java.lang.Class<? extends Model> modelClass)
Overrides:
modelFactory in class PlayPlugin

afterFixtureLoad

public void afterFixtureLoad()
Overrides:
afterFixtureLoad in class PlayPlugin


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly