> From: Curt Smith [mailto:[EMAIL PROTECTED]] > > > There are several constraints to BMP beans which make them almost always > > perform slower than CMP beans. In particular, the inability to bulk > > load beans from finder methods is a nearly fatal defect. > > I'd like to know more of the details? > > How does the container deal with the following finder in CMP > differently than BMP? > > Collection remoteRefs = home.findSalaryGreaterThan ( "50,000");
Lets assume this produces 1000 results which you then iterate through. With BMP beans, this will require 1001 database queries. First the finder, then 1000 selects to load each bean. With CMP, it's actually rather ambiguous what will happen. Last time I checked, Orion will load all the beans into an ArrayList. Yes, lots of memory consumed, but a *lot* better than 1001 database hits. Admittedly a bigger problem with orders of magnitude more objects, but even with BMP you're going to choke if the finder query returns a billion rows of primary key data. Some containers (not Orion, I don't think) allow you to specify that finders should lazy-load beans. But this brings you back to BMP performance. Some containers allow you to define "field groups" to minimize the amount of data brought back (especially useful if you store blobs), but not Orion. Personally, I don't understand why containers don't implement Collections backed by the ResultSet directly. 98% of the time, the client just creates an iterator and walks the results. If the client does something that the ResultSet can't support, build the full Collection. Jeff Schnitzer [EMAIL PROTECTED]