Bugs item #925597, was opened at 2004-03-29 14:35
Message generated for change (Comment added) made by jacyg
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=925597&group_id=22866

Category: JBossCMP
Group: v3.2
Status: Open
>Resolution: None
Priority: 5
Submitted By: Jacy Grannis (jacyg)
Assigned to: Alexey Loubyansky (loubyansky)
Summary: Problem with JDBCLoadEntityCommand in 3.2.4

Initial Comment:
There seems to be a problem with using finders in
3.2.4.  After the finder has been run, the loader
iteratively calls sql statements to load each
individual bean, and ends up generating quite a lot of
unnecessary sql statements.  I'm running 3.2.4rc1 under
java 1.4.2_01-b06.  I've included a snippet from my
logs that illustrates the problem.  The "Classes" bean
(which is merely an example, I see the same behaviour
with all my entity beans) has 4 fields, a Long primary
key, a String name, a Long type_id, and a String
description.  I rather doubt that has much to do with
it, since this behaviour doesn't exist in 3.2.1, but in
case you were wondering.  We are using the standard cmp
configuration, with the exception of changing our
strategy to "on-find" instead of "on-load".  The
observed behaviour makes 3.2.4 pretty much unusable for
doing entity beans b/c it *seriously* slows things
down.  Let me know if you have any questions.

(log messages attached, nothing snipped or anything,
it's exactly as it showed up)



----------------------------------------------------------------------

>Comment By: Jacy Grannis (jacyg)
Date: 2004-05-24 17:56

Message:
Logged In: YES 
user_id=711020

I've found the root of this problem.  The problem has to do
with the ReadAheadCache being used in multiple places.  In
particular, the load() method of the ReadAheadCache.  What
happens is this:  in the course of the entity call, the
JDBCCMRFieldBridge calls the load() method.  At the end of
the load() method, it clears out the cache for that id. 
Then, later in the course of that invocation, the
JDBCLoadEntityCommand also calls load().  This returns false
b/c the data has already been cleared out of the cache by
the earlier load().  Then, because the load() returned
false, it reruns the query to load the data up.  I'm not
sure what the proper resolution of this is, but it is
definitely a serious issue with CMP. 

----------------------------------------------------------------------

Comment By: Jacy Grannis (jacyg)
Date: 2004-03-30 10:04

Message:
Logged In: YES 
user_id=711020

Sure.  Here is the method, it is in a stateless session bean
that is using CMT.


<code>
        /**
         * @ejb.interface-method
         * Method findClazzes
         *
         * @param type
         *
         * @return
         *
         * @throws FuelQuestException
         *
         */
        public Collection findClazzes(ClazzType type) throws
FuelQuestException
        {
                try
                {
                        Collection col =
classHome.findByClazzTypeId(type.getId().getValue());

                        if ((col == null) || (col.size() == 0))
                        {
                                return Collections.EMPTY_LIST;
                        }
                        else
                        {
                                List list = new ArrayList(col.size());

                                for (Iterator it = col.iterator(); it.hasNext(); )
                                {
                                        
list.add(getClazzImpl((LocalClazzes)it.next()));
                                }

                                return list;
                        }
                }
                catch (FinderException fe)
                {
                        super.setRollbackOnly();

                        throw new FuelQuestException("Error getting classes.", fe);
                }
        }</code>

----------------------------------------------------------------------

Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-03-30 01:00

Message:
Logged In: YES 
user_id=543482

Could you post the code that triggers this SQL?

----------------------------------------------------------------------

Comment By: Jacy Grannis (jacyg)
Date: 2004-03-29 15:55

Message:
Logged In: YES 
user_id=711020

furthermore, since this behaviour didn't exist before,
before it would run the finder and then a SINGLE query to
load up the entities, this would be a bug, and should be
addressed.  CMP under jboss is unusable otherwise.

----------------------------------------------------------------------

Comment By: Jacy Grannis (jacyg)
Date: 2004-03-29 15:53

Message:
Logged In: YES 
user_id=711020

I've read your CMP docs, multiple times.  It shouldn't be
running a query for each row returned by the finder.  It
should have been able to load them in a single query.  Did
you even look at the log statements?

----------------------------------------------------------------------

Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-03-29 15:08

Message:
Logged In: YES 
user_id=543482

Please, read our CMP docs.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=925597&group_id=22866


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to