• Post Reply Bookmark Topic Watch Topic
  • New Topic

Should we be using CMPs?  RSS feed

 
Nagendra Prasad
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,
Even though I am using CMPs... I am increasingly becoming aware of how painful it is with the tools available to maintain/manange CMP projects.
Here's the situation:
I have a web based GUI developed using struts, through which I aim to
manage one entity of my database. Say for example CUSTOMER
I have the struts command object which calls a method on the session bean
which in turn calls the required data manager to perform the data management
activities.
This can be achieved in two ways:
- The data manager does it via setter methods provided by a CMP
- The data manager does it via a Data Access Object (a simple SQL Query).
The former is prob. the ideal way to do it
The latter is the easier way of doing it.
What are the advantages/disadvantages of one over the other?
Could someone please clarify....
I think in the rush to complete a lot in a small pd. of time.. there are bits that have not been thought of carefully...
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been the subject of many debates so I guess you could find better comparisons by Googling for a moment but here are some pros and cons:
CMP pros:
- Portable persistence (no need to worry about the database vendor)
- Declarative security and transactions
- Built-in support for a clustered environment (e.g. caching)
CMP cons:
- Performance might suffer
- Requires hassling with deployment descriptors
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!