org.jowidgets.cap.service.hibernate.impl
Class HibernateServiceToolkitImpl

java.lang.Object
  extended by org.jowidgets.cap.service.hibernate.impl.HibernateServiceToolkitImpl
All Implemented Interfaces:
IHibernateServiceToolkit

public final class HibernateServiceToolkitImpl
extends Object
implements IHibernateServiceToolkit


Constructor Summary
HibernateServiceToolkitImpl()
           
 
Method Summary
 ICancelServicesDecoratorProviderBuilder cancelServiceDecoratorProviderBuilder(String persistenceUnitName)
          Gets a default builder to decorate jpa services for given persistence unit.
 org.jowidgets.util.IDecorator<Throwable> exceptionDecorator()
          Gets a exception decorator that converts persistence exceptions to service exceptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateServiceToolkitImpl

public HibernateServiceToolkitImpl()
Method Detail

exceptionDecorator

public org.jowidgets.util.IDecorator<Throwable> exceptionDecorator()
Description copied from interface: IHibernateServiceToolkit
Gets a exception decorator that converts persistence exceptions to service exceptions. To set the bean id's the hibernate exceptions will be unwrapped and evaluated. Remark: When using hibernate, the entity field of some persistence exceptions (e.g. OptimisticLockExeception) will not be filled by hibernate, but the id field of the causing stale state exception is filled. So to get more convenience to the user, this exception decorator could be used without adding a hibernate dependency to the main service layer modules.

Specified by:
exceptionDecorator in interface IHibernateServiceToolkit
Returns:
A hibernate exception decorator

cancelServiceDecoratorProviderBuilder

public ICancelServicesDecoratorProviderBuilder cancelServiceDecoratorProviderBuilder(String persistenceUnitName)
Description copied from interface: IHibernateServiceToolkit
Gets a default builder to decorate jpa services for given persistence unit. decorated services will cancel the underlying hibernate session, if the execution callback gets a cancel event. Remark: If you want to use more that one persistence unit in an application, you may use more than one IServiceProviderHolder, one for each persistence unit, and decorate it manually (without java services injection). TODO MG must be verified, if this is possible.

Specified by:
cancelServiceDecoratorProviderBuilder in interface IHibernateServiceToolkit
Parameters:
persistenceUnitName - The persistence unit to get the decorator builder for
Returns:
The builder


Copyright © 2012. All Rights Reserved.