Bugs item #668533, was opened at 2003-01-15 16:36
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=668533&group_id=22866

Category: JBossCMP
Group: v3.0 Rabbit Hole
Status: Open
Resolution: None
Priority: 5
Submitted By: Halil-C. Gürsoy (che---)
Assigned to: Nobody/Anonymous (nobody)
Summary: ejbql / 3.0.5 - error in generated sql for MSSQL 2000

Initial Comment:
Hi Folks,

i have the following finder defined for my CMP entity:

         <query>
            <query-method>
               <method-name>findByRoot</method-name>
               <method-params>
               </method-params>
            </query-method>
            <ejb-ql><![CDATA[SELECT OBJECT(o) FROM
Geschaeftsfeld o WHERE o.parentGF IS NULL AND
o.ebene=0]]></ejb-ql>
         </query>

parentGF is a cmr field (see added file):
      <ejb-relation >
        
<ejb-relation-name>Geschaeftsfeld-Children</ejb-relation-name>
         <!-- bidirectional -->
         <ejb-relationship-role >
           
<ejb-relationship-role-name>GF-Parent-has-Children</ejb-relationship-role-name>
            <multiplicity>One</multiplicity>
            <relationship-role-source >
               <ejb-name>Geschaeftsfeld</ejb-name>
            </relationship-role-source>
            <cmr-field >
               <cmr-field-name>gFChildren</cmr-field-name>
              
<cmr-field-type>java.util.Collection</cmr-field-type>
            </cmr-field>
         </ejb-relationship-role>
         <ejb-relationship-role >
           
<ejb-relationship-role-name>Child-of-Parent-GF</ejb-relationship-role-name>
            <multiplicity>Many</multiplicity>
            <relationship-role-source >
               <ejb-name>Geschaeftsfeld</ejb-name>
            </relationship-role-source>
            <cmr-field >
               <cmr-field-name>parentGF</cmr-field-name>
            </cmr-field>
         </ejb-relationship-role>
      </ejb-relation>

With the 3.0.5 release i observerved that the finder
doesn't function anymore, in contrast to 3.0.4. The
following sql statements are generated.

During deployment i found this:

2003-01-15 15:52:16,904 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Geschaeftsfeld.findByRoot]
EJB-QL: SELECT OBJECT(o) FROM Geschaeftsfeld o WHERE
o.parentGF IS NULL AND o.ebene=0

2003-01-15 15:52:16,914 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Geschaeftsfeld.findByRoot]
SQL: SELECT t0_o.geschaeftsfeld_id FROM
geschaeftsfelder t0_o WHERE (t0_o.uebergeordnete_id IS
NULL AND t0_o.ebene = 0) AND
(t0_o.uebergeordnete_id=t0_o.geschaeftsfeld_id)

As you can see, there is a additional join in the
second bracket which causes the error and that is not
defined in the finder.

And then i access this finder:

15:41:37,356 DEBUG [findByRoot] Executing SQL: SELECT
t0_o.geschaeftsfeld_id FROM geschaeftsfelder t0_o WHERE
(t0_o.uebergeordnete_id IS NULL AND t0_o.ebene = 0
) AND (t0_o.uebergeordnete_id=t0_o.geschaeftsfeld_id)


In 3.0.4, for the same ear, the following sql-statement
is executed:

16:23:42,204 DEBUG [findByRoot] Executing SQL: SELECT
t0_o.geschaeftsfeld_id FROM geschaeftsfelder t0_o WHERE
t0_o.uebergeordnete_id IS NULL AND t0_o.ebene = 0

Maybe this is because this fix i have read in the
readme for 3.0.5?
-----
module: src/main/org/jboss/ejb/plugins/cmp/jdbc
; files: 
JDBCEJBQLCompiler.java

comments:
fixed bug with one-to-one and IS [NOT] NULL on a CMR
field that is not a foreign key
-----

Running all on
- Win2k prof. SP2
- JB 3.0.5 / Tomcat 4.1.18
- JDK 1.4.1-b21


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

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


-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving 
your online business a competitive advantage. Test-drive a Thawte SSL 
certificate - our easy online guide will show you how. Click here to get 
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to