aspose file tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes CMP and JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Reply Bookmark "CMP and JPA" Watch "CMP and JPA" New topic
Author

CMP and JPA

Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402
Hi Guys,

Can we combine CMP and JPA (use them in same time)

Regards
Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

It can be done, but is not recommended
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 949
    
    2

why would you?
in fact, in 3.0, JPA can replace CMP. If you write a EJB 2.1 BMP, you would be actually writing all the insert/update/delete query yourself. In CMP, you were required to just 'set' the values - for deleting, you would use 'remove' method. In JPA too, you create the object, 'set' the values and call 'entityManager.persist()' or 'entitymanager.remove()'. So, they are very similar...


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402

This is a question for a simulator

Regards
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26499
    
  78

Yes. It is valid to have existing CMP code and new JPA code in the same application. This is a common migration scenario.


[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
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402
Thanks Guys
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: CMP and JPA
 
Similar Threads
Entity Bean: CMP or BMP difference there?
CMP and BMP in EJB 3.0
Business Tier Technologies mock question?
Using CMP & JPA in same application
compoistePK class and Serializable