I’ve read that the EJB encapsulates the business logic in a Java EE environment, providing a way to re-use modules and that they could also help me to avoid writing direct SQL querys to the Database, so couldn’t I just use Hibernate for example instead EJB? are they really important to learn?
Share
Yes, you could use Hibernate for taking care of the database interfacing, and something else Spring for taking care of transaction management/boundaries. You don’t need Java EE for this.
However, as you said “they can also help me to avoid…” which is a key hint… Java EE provides an environment with transaction management, database interactions, separation of business logic and more. You don’t NEED to use it, but it’s meant to make these sorts of concerns easier if you follow the guidelines. They are important to learn if you are going to use Java EE in an environment.