Yes you can do this.
You will have to lookup the local interface in jndi.
It is bound by default at local/<your-ejb-name>
The only method currently to make a dependency between
the two is to put them in an ear.
If you deploy individually and change the ejb jar
you will get ClassCastExceptions if you don't restart
the web app.
Thanks for your response. It's already running, without problems (at least, at first sight).
Another question, although some posts says that Facade pattern is useless with local interfaces I think that its better to maintain a session layer between the servlets and the entities. I think that I can use the Data Transfer Object pattern to send data from servlet to entity (through a session bean) and use the local objects to display data at JSP's / Servlets (without the DTO's).
Is the previous architecture logical? or, am I losing the advantages of the local interfaces (by using a facade pattern)?
Again, thanks in advance,
The facade pattern is fine.
In general you should split your app into three layers
although this might be overkill for small apps.
business logic (SLSB facade)
persistence (entities with caching, locking, etc.)
The other advantage of the facade is to combine
multiple entity accesses into one transaction.