Reputation: 11
I have a a service layer composed of session beans. It is ok to let ejbs call pojos ? I want to use design patterns, for example strategy depending on a context, I call a certain strategy implemented as a pojo, is it mandatory to have the strategy classes EJBs too (may be performance, concurrecy...). What is the best practice ?
Upvotes: 1
Views: 1141
Reputation: 309028
I don't believe there is such a requirement, nor should there be.
Think of the converse: if you weren't using EJBs, would it be acceptable for those beans to call others that implemented the strategy pattern? Of course it would be.
EJB is just one among many choices for deploying a distributed component. I think there's value in implementing the functionality as a POJO, that may call other POJOs, and make the choice of remoting it as an EJB or web service or something else as late as possible. If you decide that EJBs aren't for you, all you'd have to do is re-wrap your POJO as something else and off you go. That POJO implementation will be reusable in non-EJB contexts that way.
Upvotes: 2