I have a simple CMP bean mapped to a table in Oracle8. It has no CMR's defined.

I'm using Commit option A with these beans because this is readonly data 
that is read
repeatedly in our application.

When I execute finder methods, I see the SQL generated in the log file
because 3.0 ships with DEBUG on for the CMP engine - which I find
very useful. It allows me to see a big performance problem.

After the finder query has been executed, JBoss executes some queries to load
the data for each bean from the database. These queries are broken somehow. 
Here's
an example.....

2002-06-20 10:57:49,352 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Service] Executing 
SQL: SELECT SERV_ID,ADMIN_EMAIL, SHORT_NAME ..and more columns....
FROM INDIV_SERVICES WHERE (SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?) OR 
(SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?) OR
  (SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?) 
OR (SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?) 
OR (SERV_ID=?) OR (SERV_ID=?) OR (SERV_ID=?)... and more duplicated conditions

I see this query executed multiple times when loading many beans. The 
number of conditions is initially equal to the number of rows returned by 
the finder query. Each subsequent query has a few less conditions so I 
guess that it's loading a few beans from each result set but not all of 
them. This makes for extremely slow performance.

I'm confused by the where condition and the fact the it is executed many 
times. I can see two sensible behaviours possible for these queries
but neither is the case.

1/ The where condition is built based on all of the beans that are not 
already cached. This query should be executed once and then all beans
are loaded from this one result set. This means 1 finder query and one load 
query.
2/ The where condition is build to load one or a batch of N beans and then 
executed as many times as necessary. This would be bad for performance but 
would work. In my case, I get 8 load queries for 72 beans. This results in 
load times of 3-5 seconds.

Obviously, the first behaviour would be the best because, at worst, you 
execute 2 queries. The current behaviour makes the load performance really 
bad, so bad that it won't work for our application. The only solution I can 
see for this is BMP but I'm trying to stay away from that if possible.

Once beans are loaded, I only see the finder query for subsequent calls. 
This is what I would expect. It's only the load queries that seem to be 
badly constructed/executed.

Does anyone have ideas about why this is occurring? Is there a 
configuration file where these queries are specified so that I can fix the bug?
If not, it must be a code change. Does anyone know which class this would 
be in case I wanted to try and fix the bug?

Any help is greatly appreciated.

Steve Buikhuizen



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to