I am following the below link to add UnitOfWork on non resource methods.
Create @UnitOfWork-aware proxies of existing objects
The problem is
@Inject UnitOfWorkAwareProxyFactory proxyFactory
calls the following method during application startup in Module
@Provides
@Singleton
UnitOfWorkAwareProxyFactory provideUnitOfWorkAwareProxyFactory(HibernateBundle<AlexandriaConfiguration> hibernateBundle) {
return new UnitOfWorkAwareProxyFactory(hibernateBundle);}
UnitOfWorkAwareProxyFactory calls hibernateBundle.getSessionFactory which is null at that time, which throws an exception.
Need a way to remove UnitOfWork from resource. I am using guice for dependency injection.