| Author |
JPA Query
|
Joe O'Toole
Ranch Hand
Joined: Mar 02, 2009
Posts: 50
|
|
Hi
Just wanted to make sure I was clear how persistence was impacted between ejb 2.1 and ejb 3.0
So in 2.1 we had CMP's and BMP's. With CMP's the container managed the persistence of the entities via info deployment descriptors. With BMP's, developers coded the various lifecycle method to persist, remove, create etc.
With the introduction of JPA, is it fair to say that a JPA entity is more inline with CMP. The main difference being the manner in which you specify the mappings(ORM's), now specified as annotations as opposed to XML?
So with JPA there is not equivalent of a BMP entity, right? It seems to me if you are going to use JPA you will be letting the container manage the persistence for you. So in EJB 3.0, the closest thing to BMP would be just to create a POJO and use a DAO to get the data to populate it?
Thanks
Joe
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 23635
|
|
Joe O'Toole wrote:With the introduction of JPA, is it fair to say that a JPA entity is more inline with CMP. The main difference being the manner in which you specify the mappings(ORM's), now specified as annotations as opposed to XML?
A bit oversimplified, but yes.
Joe O'Toole wrote:So with JPA there is not equivalent of a BMP entity, right? It seems to me if you are going to use JPA you will be letting the container manage the persistence for you. So in EJB 3.0, the closest thing to BMP would be just to create a POJO and use a DAO to get the data to populate it?
Correct. No BMP. BMPs are dead with no migration path.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3, OCAJP
|
 |
Joe O'Toole
Ranch Hand
Joined: Mar 02, 2009
Posts: 50
|
|
Thanks Jeanne
Just 1 further item , does this mean the concept of BMT is now dead since BMP is gone?
|
 |
Jari Timonen
Ranch Hand
Joined: Jan 16, 2004
Posts: 230
|
|
|
No. BMT is used in ejb3. Example see: EJB3 BMT
|
SCJP 5.0, SCJD URLyBird 1.3.3, OCMJEA 5 (SCEA) Factory Homes
|
 |
Joe O'Toole
Ranch Hand
Joined: Mar 02, 2009
Posts: 50
|
|
Thanks Jari
Can BMT be used on an entity which has its data persisted via JPA or is it just for session and MDB's
Joe
|
 |
Jari Timonen
Ranch Hand
Joined: Jan 16, 2004
Posts: 230
|
|
I think concept is that bean manager it's transaction manually. Which mean that developer codes transaction boundaries (start/commit/rollback) itself.
http://docs.oracle.com/javaee/5/tutorial/doc/bnciy.html
http://geertschuring.wordpress.com/2008/10/07/how-to-use-bean-managed-transactions-with-ejb3-jpa-and-jta/
http://www.java2s.com/Code/Java/JPA/StartTransactionandCommit.htm
So, you can configure manually transactions with jta.
|
 |
 |
|
|
subject: JPA Query
|
|
|