Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does EJB and JPA relate? [duplicate]

I am reading the EJB 3 in Action book and I have the following question :
Is the POJO's you write and annotate with @Entity and so on also a EJB entity type?

I don't understand what JPA has to do with EJB. Isn't JPA a own specification now? The entities are also contained in a own persistence container. They talk about EJB 3 Java Persistence API etc. but I don't understand what entities has to do with EJB.

like image 689
LuckyLuke Avatar asked Jan 21 '12 11:01

LuckyLuke


1 Answers

JPA has been designed to replace EJB2 entity beans, and has started as a part of the EJB3 specification.

Since it makes sense to also use JPA outside of an EJB container, it has now its own specification, but it's still related to EJB3, since a compliant EJB3 container has to provide a JPA implementation, which integrates into the transaction handling of the container.

like image 187
JB Nizet Avatar answered Oct 18 '22 14:10

JB Nizet