Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

BMP / CMP doubt  RSS feed

 
Sonal Ray
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have a small silly doubt.

Can CMP and BMP be combined?

My question is; can I go for

1. DAO for search PRODUCT and
2. CMP for data persistence ( eg. ORDER) in the same application.
[ April 15, 2006: Message edited by: Sonal Ray ]
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can CMP and BMP be combined?

Yes you can have BMP and CMP even for one Database Table in the same time.

1. DAO for search PRODUCT and
2. CMP for data persistence ( eg. ORDER) in the same application.


DAO is a pattern which we usually use to encapsulate Data Acces logic in a seperate layer. you can use DAO on top of any persistence mechanism.

so ,Yes you can use DAO pattern on top of any other persistence mechanism in your application and meanwhile you can use CMPs to manage your data too.


for example use some plain JDBC wrapped by DAO pattern to search for your data and CMPs to insert / update /.... of other data or those data that you are going to serch.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sonal,
Yes. What you describe is common. Especially for large/complex read only queries.

One thing to note: it is ok to do DAO reads and CMP writes, but not CMP reads and DAO writes. The EJB container caches beans so it may not know the record was updated by a DAO.
 
Sonal Ray
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. It clarifies my doubt.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!