• Post Reply Bookmark Topic Watch Topic
  • New Topic

Finder Object to get the Count(*)

 
John Milton
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using CMP type of Entity.I need to get the count of records that satisfy a particular condition.(for eg Select count(*) from emp where name like'V%').
How could this be done in EJB (Websphere)?
With regards,
Milton.
 
Tim Holloway
Bartender
Posts: 18413
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a problem there. Any columns you retrieve from the database need to be writable back to the database in a CMP bean. Calculated values defeat that model. This is the kind of thing BMPs are used for.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just write a method in a separate session bean that executes the JDBC and SQL logic to get the count. It's by far the easiest way.
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!