org.apache.ojb.odmg
Class OQLOrOnForeignKeyTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.ojb.odmg.OQLOrOnForeignKeyTest
All Implemented Interfaces:
junit.framework.Test

public class OQLOrOnForeignKeyTest
extends junit.framework.TestCase

Author:
Matthew.Baird Illustrates a problem with OJB SQL Generation: 1. OJB will generate the following SQL when items are mapped to the same table: SELECT A0.FATHER_ID,A0.MOTHER_ID,A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM FAMILY_MEMBER A0 INNER JOIN FAMILY_MEMBER A2 ON A0.FATHER_ID=A2.ID INNER JOIN FAMILY_MEMBER A1 ON A0.MOTHER_ID=A1.ID WHERE A1.ID = ? OR (A2.ID = ? ) When it should generate: SELECT A0.FATHER_ID,A0.MOTHER_ID,A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM FAMILY_MEMBER A0 WHERE A0.FATHER_ID = ? OR (A0.MOTHER_ID = ? ) or: SELECT A0.FATHER_ID,A0.MOTHER_ID,A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM FAMILY_MEMBER A0 LEFT OUTER JOIN FAMILY_MEMBER A1 ON A0.MOTHER_ID=A1.ID LEFT OUTER JOIN FAMILY_MEMBER A2 ON A0.FATHER_ID=A2.ID WHERE A1.ID = ? OR (A2.ID = ?)

Constructor Summary
OQLOrOnForeignKeyTest(java.lang.String name)
          Insert the method's description here.
 
Method Summary
static void main(java.lang.String[] args)
           
 void setUp()
          Insert the method's description here.
 void tearDown()
          Insert the method's description here.
 void testOrReferenceOnDifferentTables()
           
 void testOrReferenceOnSameTable()
          test joins on same table
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OQLOrOnForeignKeyTest

public OQLOrOnForeignKeyTest(java.lang.String name)
Insert the method's description here. Creation date: (24.12.2000 00:33:40)

Method Detail

setUp

public void setUp()
Insert the method's description here. Creation date: (06.12.2000 21:58:53)


tearDown

public void tearDown()
              throws java.lang.Exception
Insert the method's description here. Creation date: (06.12.2000 21:59:14)

Throws:
java.lang.Exception

testOrReferenceOnSameTable

public void testOrReferenceOnSameTable()
                                throws java.lang.Exception
test joins on same table

Throws:
java.lang.Exception

testOrReferenceOnDifferentTables

public void testOrReferenceOnDifferentTables()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14