Please forgive me for the generic subject, but I have been researching for a long time in a number of places and have not found anything that would satisfactorily explain what an EJB really is and what it does.
I am adept at using real examples at all for a better understanding and found few followers of this style in the tutorials I saw. Generally, they say that EJB is essentially a managed component that is created, controlled, and destroyed by the generator container of the J2EE that is running . That does not tell me anything or nothing. In fact I left the text with more doubts than before.
Looking for more, I have been able to understand that EJBs are autonomous modules that receive requests and return responses, as any method, with the advantage that they can be invoked from external applications. Is that correct?A simple and practical example would be an EJB that receives the CPF from a customer inquiring whether or not it is approved to make a purchase by check. Within this EJB there would be various business rules (account time, credit card instances, etc.), even queries to other EJBs, in order to "pull the chip" from the client and finally return a YES or NO to who summoned him. This EJB could be used by any client : a mobile, web or desktop application.
Does anyone have anything else to add?
However, I have some doubts: what is the difference of an EJB for a WebService? (the latter yes I know what it is and I have used it several times).
What is the relationship between JPA and EJB? I have done several applications using Hibernate, which is a JPA framework. Does that mean I've used EJB?
Thank you!