Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA Query

 
Joe O'Toole
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joe O'Toole
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne

Just 1 further item , does this mean the concept of BMT is now dead since BMP is gone?
 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. BMT is used in ejb3. Example see: EJB3 BMT
 
Joe O'Toole
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic