IntelliJ Java IDE
The moose likes EJB and Other Java EE Technologies and the fly likes Finder Object to get the Count(*) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "Finder Object to get the Count(*)" Watch "Finder Object to get the Count(*)" New topic
Author

Finder Object to get the Count(*)

John Milton
Greenhorn

Joined: Nov 07, 2001
Posts: 1
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
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

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.


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3878
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.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
jQuery in Action, 2nd edition
 
subject: Finder Object to get the Count(*)
 
Threads others viewed
problem in appending new row in excel sheet using POI API
naming a class instance
How many class' are there in JDK?
Rude Ranchers
Count of waiting threads
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture