org.jowidgets.cap.service.hibernate.api
Interface IHibernateServiceToolkit

All Known Implementing Classes:
HibernateServiceToolkitImpl

public interface IHibernateServiceToolkit


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.
 

Method Detail

exceptionDecorator

org.jowidgets.util.IDecorator<Throwable> exceptionDecorator()
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.

Returns:
A hibernate exception decorator

cancelServiceDecoratorProviderBuilder

ICancelServicesDecoratorProviderBuilder cancelServiceDecoratorProviderBuilder(String persistenceUnitName)
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.

Parameters:
persistenceUnitName - The persistence unit to get the decorator builder for
Returns:
The builder


Copyright © 2012. All Rights Reserved.