Hi,
So this is brings me to another question - does this mean that I do NOT have to use EJB 3.0 annotation (ex: @Entity) in JPA projects at all or any EJBs whatsoever? How will that work?
Not correct..JPA needs to know which entities the PersistenceManager should manage and that is denoted by @Entity annotation.
Now regarding the relationship between JPA and EJB
Prior to EJB 3.0, we used to map database entities with Entity Beans. These entity beans needed the EJB Container to run them and they were not POJOs. Then came hibernate which addressed ORM (Object Relational Mapping) using POJO and without the need of Application server runtime. POJOs definitely has lot of advantages in terms of improving productivity and less number of classes to create, to name a few.
This lead to the thoght of deprecating earlier Entity beans model and aligning the EJB 3.0 entity beans with the POJO model as in Hibernate. If you have worked with hibernate then you can make out that the JPA specification is modelled on the Hibernate specifications. Gavin King who wrote hibernate was/is involved creating the JPA specifications.
The JPA entities can be worked with even outside the EJB Container that comes with Application server. Also now you do not need to write different home and remote interfaces to access these. You inject the PersistenceContext and start using the JPA entities. If you are using EJB 3.0 stateless/stateful/Messagedriven beans then using @PersistenceContext you can easily get hold of PersistenceContext and start using the JPA Entities.
The JPA entities can also be used in the Stand-alone mode in a simple
Java application. I think there you need to get hold of PersistenceContext manually.
This is not all about EJB 3.0 and JPA but maybe you can find this useful while reading more about it.
Regds,
Amit