Reputation: 1437
I am reading architect related articles. I read that EJB has benefits of Container managed transaction and thread management.
Ok here I have 2 questions now.
1) If we consider container managed transaction only then I have choice of using Hibernate or simple JTA in other application. AM I right?
2) I did not get how EJB supports thread management?
Upvotes: 0
Views: 108
Reputation: 2871
I will be brief :
1) You can use Hibernate in either way. It understands JTA transaction demarcations, and you can also use Hibernate without JTA. Remember: JPA, JTA - interfaces/APIs; Hibernate, TopLink, iBatis, etc - implementations.
2) Well, EJB container provides environment for container managed beans. It can spawn multiple instances of your beans (stateless beans and message beans, for instance) and manage them in some kind of thread-safe fashion. This is not part of EJB spec so it's implementation specific. The spec is actually discourages you from doing anything fancy with your beans and threads. You just configure how many instances of particular beans you want to be available at any given time, and the container takes over.
Upvotes: 1