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
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to