File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes JPA Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "JPA Query" Watch "JPA Query" New topic
Author

JPA Query

Joe O'Toole
Ranch Hand

Joined: Mar 02, 2009
Posts: 51
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

Joined: May 26, 2003
Posts: 30752
    
156

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]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Joe O'Toole
Ranch Hand

Joined: Mar 02, 2009
Posts: 51
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: 232
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: 51
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: 232
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA Query