Hi all,

I have a question about the applicationContext.xml generated by the Spring cartridge.

We're using the Spring-cartridge with Hibernate, but without EJBs.
The generated applicationContext.xml file contains the following relevant beans:
- 'transactionManager' (org.springframework.orm.hibernate.HibernateTransactionManager).
- 'hibernateInterceptor' (org.springframework.orm.hibernate.HibernateInterceptor)
- 'entityTransactionInterceptor' (org.springframework.transaction.interceptor.TransactionInterceptor)
- 'serviceTransactionInterceptor' (org.springframework.transaction.interceptor.TransactionInterceptor)

But I'm wondering why the DAOs are proxied with the 'entityTransactionInterceptor'.
Is the 'entityTransactionInterceptor' actually needed, since transaction boundaries should be demarcated on business fa�ades only (service beans).
I think DAOs should never be exposed to clients (e.g. the web tier); they should always be invoked through the business layer.

On the other hand, service beans are correctly proxied with the 'serviceTransactionInterceptor', but also with a 'hibernateInterceptor'.
I thought a 'hibernateInterceptor' only made sense on a DAO implemented with Hibernate, am I right?
(See Spring reference section Data Access Using Relational Mappers > Hibernate > Applying an AOP Interceptor instead of a Template).

I had one more little problem:
I would like to create a child ApplicationContext in another package, using the instance of generated applicationContext.xml as a parent.
But I couldn't get a reference to the ApplicationContext instance of the ServiceLocator singleton because the ServiceLocator.instance().getContext() method has protected accessibility.
Since the ServiceLocator default constructor is private, I'm not sure the protected modifier makes sense anyway.
Couldn't this method be declared public instead?

Thanks for your help,

Johnny.

Reply via email to