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


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

Comment By: Stefan Kuehnel (skuehnel)
Date: 2003-01-21 15:33

Message:
Logged In: YES 
user_id=596644

Positive feedback: The change in CVS as of today fixes the problem for me.

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

Comment By: Stefan Kuehnel (skuehnel)
Date: 2003-01-15 16:51

Message:
Logged In: YES 
user_id=596644

I was just to file a similar bug report. So I just add that I have similar problems 
under Linux with a MySQL database.  Can provide the exact EJB QL and SQL statements if 
necessary.

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

Comment By: Halil-C. Gürsoy (che---)
Date: 2003-01-15 16:50

Message:
Logged In: YES 
user_id=455149

I should mention that "geschaeftsfeld_id" is the pk of the
entity, which is found in the wrong statement.




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

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: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to