Thursday, December 22, 2005

XDoclet (EJB) and Spring

My project was using XDoclet to annotate our EJBs. I wanted to use Spring, and still keep the EJB, so I had the bean class extend Spring's AbstractStatelessSessionBean. The problem? The classes that XDoclet generated extended AbstractStatelessSessionRemote, AbstractStatelessSessionLocal, etc., all of which, don't exist.

The solution? Quite simple... by using the @ejb.home and @ejb.interface attributes, you can override the default behavior and specify which interface(s) the home interface and component interface should extend.

Example:
@ejb.home
extends="javax.ejb.EJBHome"
local-extends="javax.ejb.EJBLocalHome"

No comments: