Package org.zkoss.zkplus.jpa
Class OpenEntityManagerInViewListener
- java.lang.Object
-
- org.zkoss.zkplus.jpa.OpenEntityManagerInViewListener
-
- All Implemented Interfaces:
org.zkoss.zk.ui.util.ExecutionCleanup,org.zkoss.zk.ui.util.ExecutionInit
public class OpenEntityManagerInViewListener extends java.lang.Object implements org.zkoss.zk.ui.util.ExecutionCleanup, org.zkoss.zk.ui.util.ExecutionInitListener to init and cleanup the JPA entityManager automaticallyIn WEB-INF/zk.xml, add following lines:
<listener> <description>Hibernate "OpenEntityManagerInView" Listener</description> <listener-class>org.zkoss.zkplus.jpa.OpenEntityManagerInViewListener</listener-class> </listener>Applicable to EJB version 3.2.ga or later
- Since:
- 3.0.2
- Author:
- Jeff
-
-
Constructor Summary
Constructors Constructor Description OpenEntityManagerInViewListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup(org.zkoss.zk.ui.Execution exec, org.zkoss.zk.ui.Execution parent, java.util.List errs)protected voidhandleException(org.zkoss.zk.ui.Execution exec, java.lang.Throwable ex)Default exception handler.voidinit(org.zkoss.zk.ui.Execution exec, org.zkoss.zk.ui.Execution parent)
-
-
-
Method Detail
-
cleanup
public void cleanup(org.zkoss.zk.ui.Execution exec, org.zkoss.zk.ui.Execution parent, java.util.List errs) throws java.lang.Exception- Specified by:
cleanupin interfaceorg.zkoss.zk.ui.util.ExecutionCleanup- Throws:
java.lang.Exception
-
init
public void init(org.zkoss.zk.ui.Execution exec, org.zkoss.zk.ui.Execution parent) throws java.lang.Exception- Specified by:
initin interfaceorg.zkoss.zk.ui.util.ExecutionInit- Throws:
java.lang.Exception
-
handleException
protected void handleException(org.zkoss.zk.ui.Execution exec, java.lang.Throwable ex)Default exception handler. This implementation simply rollback the transaction.
Application developer might want to extends this class and override this method to do other things like compensate for any permanent changes during the conversation, and finally restart business conversation... what can be done here depends on the applications design.
- Parameters:
exec- the execution to clean up.ex- the Throwable which is not handled during the execution
-
-