• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CMP and JPA

 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

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

Regards
 
Rishi Shehrawat
Ranch Hand
Posts: 218
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It can be done, but is not recommended
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1103
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This is a question for a simulator

Regards
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35276
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. It is valid to have existing CMP code and new JPA code in the same application. This is a common migration scenario.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic