[
http://jira.jboss.com/jira/browse/JBAS-1554?page=comments#action_12316120 ]
Johan Borchers commented on JBAS-1554:
--------------------------------------
I noticed the same problem on 4.0.1 and 4.0.1sp1 using db MySQL 4.1.9.
I have 2 simular queries with the same read ahead strategy. The first one is
normal and the other is dynamic-ql. The first one I can see in the server.log
loads all data and related data from the result set in the read ahead cache.
This is nice because that is what I expected from the left outer join.
But when the dynamic QL is executed only the data from the main EJB is loaded
into the read ahead cache. The left joins are performed with the SQL executed.
But the data from the left joins is not loaded into the read ahead cache.
When loading fields from the beans from the related parent beans the data is
selected again from the database with a "load relation SQL" statement.
It seems that with dynamic-ql the CMP engine forgets that the related data was
already selected from the database with a left join.
<query>
<query-method>
<method-name>findByContractor</method-name>
<method-params>
<method-param>nl.vda.contractsys.j2ee.ejb.contractor.ContractorLocal</method-param>
</method-params>
</query-method>
<read-ahead>
<strategy>on-find</strategy>
<eager-load-group>lite</eager-load-group>
<left-join cmr-field="type" eager-load-group="all"></left-join>
<left-join cmr-field="subject" eager-load-group="all"></left-join>
<left-join cmr-field="durationPeriod" eager-load-group="all"></left-join>
<left-join cmr-field="periodOfNoticePeriod"
eager-load-group="all"></left-join>
</read-ahead>
</query>
<query>
<query-method>
<method-name>ejbSelectGeneric</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.Object[]</method-param>
</method-params>
</query-method>
<dynamic-ql/>
<read-ahead>
<strategy>on-find</strategy>
<eager-load-group>lite</eager-load-group>
<left-join cmr-field="type" eager-load-group="all"></left-join>
<left-join cmr-field="subject" eager-load-group="all"></left-join>
<left-join cmr-field="durationPeriod" eager-load-group="all"></left-join>
<left-join cmr-field="periodOfNoticePeriod"
eager-load-group="all"></left-join>
</read-ahead>
</query>
Johan.
> Dynamic query - left join data not loaded in read ahead cache
> -------------------------------------------------------------
>
> Key: JBAS-1554
> URL: http://jira.jboss.com/jira/browse/JBAS-1554
> Project: JBoss Application Server
> Type: Bug
> Components: CMP service
> Versions: JBossAS-4.0.1 SP1
> Environment: Sun JDK 1.5.0
> JBoss 4.0.1 SP1
> Reporter: Dan Pupaza
> Priority: Critical
>
>
> I added a left-join entry in jbosscmp-jdbc.xml file for a dynamic query. The
> generated query is correct, but the data for the bean corresponding to the
> CMR field defined in read-ahead/left-join are loaded from database, not from
> read ahead cache.
> The dynamic-ql query is:
> 2005-03-08 13:19:36,455 DEBUG
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.Subject#ejbSelectAllChoosableSubjects]
> DYNAMIC-QL:
> SELECT OBJECT(s) FROM Subject AS s
> WHERE s.id > 0 AND s.deprecated IS NULL
> ORDER BY s.categoryId, s.name ASC
> Corresponding fragment in jbosscmp-jdbc.xml is:
> <query>
> <query-method>
> <method-name>ejbSelectAllChoosableSubjects</method-name>
> <method-params>
> <method-param>java.lang.String</method-param>
> <method-param>java.lang.Object[]</method-param>
> </method-params>
> </query-method>
> <dynamic-ql/>
> <read-ahead>
> <strategy>on-find</strategy>
> <eager-load-group>*</eager-load-group>
> <left-join cmr-field="subjectcategory" eager-load-group="*"/>
> </read-ahead>
> </query>
> Generated query:
> 2005-03-08 13:19:36,463 DEBUG
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.Subject#ejbSelectAllChoosableSubjects]
> Executing SQL:
> SELECT t0_s.id, t0_s.name, t0_s.author, t0_s.lastModified, t0_s.comments,
> t0_s.deprecated, t0_s.categoryId, t0_s.pos, t1_s_subjectcategory.id,
> t1_s_subjectcategory.name, t1_s_subjectcategory.pos, t0_s.categoryId,
> t0_s.name
> FROM SUBJECT t0_s
> LEFT OUTER JOIN SUBJECTCATEGORY t1_s_subjectcategory ON
> t0_s.categoryId=t1_s_subjectcategory.id
> WHERE t0_s.id > 0 AND t0_s.deprecated IS NULL
> ORDER BY t0_s.categoryId ASC, t0_s.name ASC
> A fragment from server.log file:
> 2005-03-08 13:19:36,692 DEBUG
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Subjectcategory#findByPrimaryKey]
> Executing SQL: SELECT t0_Subjectcategory.id FROM SUBJECTCATEGORY
> t0_Subjectcategory WHERE t0_Subjectcategory.id=?
> 2005-03-08 13:19:37,641 DEBUG
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Subjectcategory]
> Executing SQL: SELECT name FROM SUBJECTCATEGORY WHERE (id=?)
> 2005-03-08 13:19:37,763 DEBUG
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Subjectcategory#findByPrimaryKey]
> Executing SQL: SELECT t0_Subjectcategory.id FROM SUBJECTCATEGORY
> t0_Subjectcategory WHERE t0_Subjectcategory.id=?
> 2005-03-08 13:19:37,765 DEBUG
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Subjectcategory]
> Executing SQL: SELECT name FROM SUBJECTCATEGORY WHERE (id=?)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development