db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb repository_junit_odmg.xml
Date Thu, 22 Jan 2004 16:01:19 GMT
arminw      2004/01/22 08:01:19

  Modified:    src/test/org/apache/ojb/odmg OQLTest.java
               src/test/org/apache/ojb repository_junit_odmg.xml
  Log:
  fix test cases, avoid primitive type for FK fields
  
  Revision  Changes    Path
  1.14      +596 -47   db-ojb/src/test/org/apache/ojb/odmg/OQLTest.java
  
  Index: OQLTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/OQLTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- OQLTest.java	15 Nov 2003 21:45:55 -0000	1.13
  +++ OQLTest.java	22 Jan 2004 16:01:19 -0000	1.14
  @@ -1,25 +1,22 @@
  -/*
  - * Created by IntelliJ IDEA.
  - * User: Matt
  - * Date: May 19, 2002
  - * Time: 3:43:36 PM
  - * To change template for new class use
  - * Code Style | Class Templates options (Tools | IDE Options).
  - */
   package org.apache.ojb.odmg;
   
   import junit.framework.TestCase;
  -import org.apache.ojb.broker.*;
   import org.odmg.Database;
   import org.odmg.Implementation;
   import org.odmg.OQLQuery;
   import org.odmg.Transaction;
  +import org.apache.ojb.broker.TestHelper;
   
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.List;
  +import java.io.Serializable;
   
  +/**
  + *
  + * @version $Id$
  + */
   public class OQLTest extends TestCase
   {
   
  @@ -60,9 +57,7 @@
   	private void createData(Database db, Implementation odmg)
   			throws Exception
   	{
  -//        Implementation odmg = OJB.getInstance();
   		Transaction tx = odmg.newTransaction();
  -//        db.open(databaseName, Database.OPEN_READ_WRITE);
   		tx.begin();
   		for (int i = 0; i < COUNT; i++)
   		{
  @@ -73,7 +68,6 @@
   			db.makePersistent(aPerson);
   		}
   		tx.commit();
  -
   	}
   
   	private void deleteData(Database db, Implementation odmg)
  @@ -127,10 +121,10 @@
   			query.create(sql);
   			query.bind(new Integer(id_filter));
   
  -			ManageableCollection allPersons = (ManageableCollection) query.execute();
  +			Collection allPersons = (Collection) query.execute();
   
   			// Iterator over the restricted articles objects
  -			java.util.Iterator it = allPersons.ojbIterator();
  +			java.util.Iterator it = allPersons.iterator();
   
   			while (it.hasNext())
   			{
  @@ -254,10 +248,19 @@
   		Mammal cat = new Mammal(4, "Winston", 4);
   		Reptile snake = new Reptile(4, "Skuzzlebutt", "green");
   		Implementation odmg = OJB.getInstance();
  -
   		Database db = odmg.newDatabase();
   		db.open(databaseName, Database.OPEN_READ_WRITE);
  -		Transaction tx = odmg.newTransaction();
  +
  +        Transaction tx = odmg.newTransaction();
  +		tx.begin();
  +		OQLQuery query = odmg.newOQLQuery();
  +		query.create("select animals from " + InterfaceAnimal.class.getName() +
  +					 " where name in list (\"Minnie\", \"Winston\", \"Skuzzlebutt\")");
  +		int before = ((Collection) query.execute()).size();
  +		tx.commit();
  +
  +
  +		tx = odmg.newTransaction();
   		tx.begin();
   		db.makePersistent(elephant);
   		db.makePersistent(cat);
  @@ -266,12 +269,9 @@
   
   		tx = odmg.newTransaction();
   		tx.begin();
  -		OQLQuery query = odmg.newOQLQuery();
  -		query.create("select animals from " + InterfaceAnimal.class.getName() +
  -					 " where name in list (\"Minnie\", \"Winston\", \"Skuzzlebutt\")");
   		List animals = (List) query.execute();
   		tx.commit();
  -		assertEquals(3, animals.size());
  +		assertEquals(before + 3, animals.size());
   	}
   
   	public void testPrefetchQuery() throws Exception
  @@ -294,18 +294,22 @@
   
   	public void testInterfaceQuery() throws Exception
   	{
  -		//objects that are part of a 1:n relation, i.e. they have fk-fields
  -		Mammal elephant = new Mammal(4, "Jumbo", 4);
  -		Mammal cat = new Mammal(4, "Silvester", 4);
  -		Reptile snake = new Reptile(4, "Kaa", "green");
  +		int age = (int)(Math.random() * Integer.MAX_VALUE);
  +		int calories = (int)(Math.random() * Integer.MAX_VALUE);
  +		int caloriesOther = (int)(Math.random() * Integer.MAX_VALUE);
  +
  +        //objects that are part of a 1:n relation, i.e. they have fk-fields
  +		Mammal elephant = new Mammal(age, "Jumbo", 4);
  +		Mammal cat = new Mammal(age, "Silvester", 4);
  +		Reptile snake = new Reptile(age, "Kaa", "green");
   
   		//objects that are independent or part of m:n relations, i.e. they
   		//don't have fk-fields
  -		Fish tuna = new Fish("tuna", 1000, "salt");
  -		Fish trout = new Fish("trout", 1000, "fresh water");
  +		Fish tuna = new Fish("tuna", calories, "salt");
  +		Fish trout = new Fish("trout", calories, "fresh water");
   
  -		Salad radiccio = new Salad("Radiccio", 1000, "red");
  -		Salad lolloverde = new Salad("Lollo verde", 7, "green");
  +		Salad radiccio = new Salad("Radiccio", calories, "red");
  +		Salad lolloverde = new Salad("Lollo verde", caloriesOther, "green");
   
   		Implementation odmg = OJB.getInstance();
   		Database db = odmg.newDatabase();
  @@ -316,8 +320,6 @@
   		db.makePersistent(elephant);
   		db.makePersistent(cat);
   		db.makePersistent(snake);
  -
  -
   		db.makePersistent(tuna);
   		db.makePersistent(trout);
   		db.makePersistent(radiccio);
  @@ -329,13 +331,14 @@
   		OQLQuery query = odmg.newOQLQuery();
   		query.create("select animals from " + InterfaceAnimal.class.getName() +
   					 " where age=$1");
  -		query.bind(new Integer(4));
  +		query.bind(new Integer(age));
   		List animals = (List) query.execute();
   		tx.commit();
   		Iterator it = animals.iterator();
   		while (it.hasNext())
   		{
  -			System.out.println(it.next());
  +			Object obj = it.next();
  +            // System.out.println(obj);
   		}
   		assertEquals(3, animals.size());
   
  @@ -344,14 +347,14 @@
   		tx.begin();
   		query.create("select food from " + InterfaceFood.class.getName() +
   					 " where calories=$1");
  -		query.bind(new Integer(1000));
  +		query.bind(new Integer(calories));
   		List food = (List) query.execute();
   		tx.commit();
   		assertEquals(3, food.size());
   	}
  -    
  +
       /**
  -     * 
  +     *
        */
       public void _testFunctions() throws Exception
       {
  @@ -363,15 +366,15 @@
           tx.begin();
   
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select anArticle from " + 
  +        query.create("select anArticle from " +
                   Article.class.getName() +
                   " where upper(articleName) like \"A%\" ");
  -        
  +
           List results = (List) query.execute();
           tx.commit();
           assertTrue(results.size() > 0);
           db.close();
  -    }    
  +    }
   
       /**
        * ReportQuery returning rows with summed stock and price per article group
  @@ -398,9 +401,9 @@
           tx.commit();
           assertTrue(results.size() > 0);
           db.close();
  -    }    
  -    
  -    
  +    }
  +
  +
       /**
        * test Subquery
        * get all articles with price > avg(price)
  @@ -416,12 +419,12 @@
   
           Transaction tx = odmg.newTransaction();
           tx.begin();
  -     
  +
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select anArticle from " + 
  -                Article.class.getName() + 
  -                " where " + 
  -                " price >= (select avg(price) from " + 
  +        query.create("select anArticle from " +
  +                Article.class.getName() +
  +                " where " +
  +                " price >= (select avg(price) from " +
                   Article.class.getName() +
                   " where articleName like \"A%\") ");
   
  @@ -430,5 +433,551 @@
           assertTrue(results.size() > 0);
           db.close();
       }
  -    
  +
  +
  +    //*******************************************************************
  +    // test classes start here
  +    //*******************************************************************
  +    public interface InterfaceAnimal extends Serializable
  +    {
  +        int getAge();
  +        String getName();
  +    }
  +
  +    public interface InterfaceFood extends Serializable
  +    {
  +        String getName();
  +        int getCalories();
  +
  +    }
  +
  +    public static abstract class AbstractAnimal
  +    {
  +        int animalId;
  +        String name;
  +        Integer zooId;
  +
  +        public int getAnimalId()
  +        {
  +            return animalId;
  +        }
  +
  +        public void setAnimalId(int animalId)
  +        {
  +            this.animalId = animalId;
  +        }
  +
  +        public String getName()
  +        {
  +            return name;
  +        }
  +
  +        public void setName(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +        public Integer getZooId()
  +        {
  +            return zooId;
  +        }
  +
  +        public void setZooId(Integer zooId)
  +        {
  +            this.zooId = zooId;
  +        }
  +    }
  +
  +    public static class Mammal extends AbstractAnimal implements InterfaceAnimal, Serializable
  +    {
  +        private int age;
  +        private int numLegs;
  +
  +        public Mammal()
  +        {
  +            super();
  +        }
  +
  +        public Mammal(int age, String name, int numLegs)
  +        {
  +            this.age = age;
  +            this.name = name;
  +            this.numLegs = numLegs;
  +        }
  +
  +        public String toString()
  +        {
  +            return "Mammal: id = " + animalId + "\n name = " + name +
  +                    "\n age = " + age +
  +                    "\n Number of legs = " + numLegs +
  +                    "\n zooId = " + zooId;
  +        }
  +
  +        public int getAge()
  +        {
  +            return age;
  +        }
  +
  +        public int getNumLegs()
  +        {
  +            return numLegs;
  +        }
  +
  +        public void setNumLegs(int numLegs)
  +        {
  +            this.numLegs = numLegs;
  +        }
  +    }
  +
  +
  +    public static class Reptile extends AbstractAnimal implements InterfaceAnimal, Serializable
  +    {
  +        private int age;
  +        private String color;
  +        /**
  +         * Constructor for Plant.
  +         */
  +        public Reptile()
  +        {
  +            super();
  +        }
  +
  +        public Reptile(int age, String name, String color)
  +        {
  +         this.age = age;
  +         this.name = name;
  +         this.color = color;
  +        }
  +
  +        public int getAge()
  +        {
  +            return age;
  +        }
  +
  +        public int getAnimalId()
  +        {
  +            return animalId;
  +        }
  +
  +        public void setAnimalId(int animalId)
  +        {
  +            this.animalId = animalId;
  +        }
  +
  +        public String getName()
  +        {
  +            return name;
  +        }
  +
  +        public void setName(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +        public String getColor()
  +        {
  +            return color;
  +        }
  +
  +        public void setColor(String color)
  +        {
  +            this.color = color;
  +        }
  +
  +        public String toString()
  +        {
  +            return "Reptile: id = " + animalId + "\n name = " + name +
  +                    "\n age = " + age +
  +                    "\n color = " + color +
  +                    "\n zooId = " + zooId;
  +        }
  +    }
  +
  +
  +    public static class Fish implements InterfaceFood, Serializable
  +    {
  +        int foodId;
  +        String name;
  +        int calories;
  +        String typeOfWater;
  +
  +        /**
  +         * Constructor for Fish.
  +         */
  +        public Fish()
  +        {
  +            super();
  +        }
  +
  +        public Fish(String name, int calories, String typeOfWater)
  +        {
  +            this.calories = calories;
  +            this.name = name;
  +            this.typeOfWater = typeOfWater;
  +        }
  +
  +        /**
  +         * @see org.apache.ojb.broker.InterfaceFood#getName()
  +         */
  +        public String getName()
  +        {
  +            return name;
  +        }
  +
  +        /**
  +         * @see org.apache.ojb.broker.InterfaceFood#getCalories()
  +         */
  +        public int getCalories()
  +        {
  +            return calories;
  +        }
  +
  +
  +
  +        /**
  +         * Returns the typeOfWater.
  +         * @return String
  +         */
  +        public String getTypeOfWater()
  +        {
  +            return typeOfWater;
  +        }
  +
  +        /**
  +         * Returns the foodId.
  +         * @return int
  +         */
  +        public int getFoodId()
  +        {
  +            return foodId;
  +        }
  +
  +        public String toString()
  +        {
  +           return "Fish: id = " + foodId + "\n name = " + name +
  +                    "\n calories = " + calories +
  +                    "\n Type of water = " + typeOfWater;
  +        }
  +
  +
  +        /**
  +         * Sets the calories.
  +         * @param calories The calories to set
  +         */
  +        public void setCalories(int calories)
  +        {
  +            this.calories = calories;
  +        }
  +
  +        /**
  +         * Sets the foodId.
  +         * @param foodId The foodId to set
  +         */
  +        public void setFoodId(int foodId)
  +        {
  +            this.foodId = foodId;
  +        }
  +
  +        /**
  +         * Sets the name.
  +         * @param name The name to set
  +         */
  +        public void setName(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +        /**
  +         * Sets the typeOfWater.
  +         * @param typeOfWater The typeOfWater to set
  +         */
  +        public void setTypeOfWater(String typeOfWater)
  +        {
  +            this.typeOfWater = typeOfWater;
  +        }
  +
  +    }
  +
  +
  +
  +    public static class Gourmet implements Serializable
  +    {
  +        int gourmetId;
  +        String name;
  +        List favoriteFood = new ArrayList();
  +        /**
  +         * Constructor for Gourmet.
  +         */
  +        public Gourmet()
  +        {
  +            super();
  +        }
  +
  +        public Gourmet(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +        public List getFavoriteFood()
  +        {
  +            return favoriteFood;
  +        }
  +
  +        public void addFavoriteFood(InterfaceFood food)
  +        {
  +            favoriteFood.add(food);
  +        }
  +
  +        /**
  +         * Returns the gourmetId.
  +         * @return int
  +         */
  +        public int getGourmetId()
  +        {
  +            return gourmetId;
  +        }
  +
  +        public String toString()
  +        {
  +         StringBuffer text = new StringBuffer("Gourmet: id = " + gourmetId + "\n");
  +         text.append("name = ");
  +         text.append(name);
  +         text.append("\nFavoriteFood:\n");
  +         for(Iterator it = favoriteFood.iterator(); it.hasNext();)
  +         {
  +            text.append(it.next().toString());
  +            text.append("\n-------\n");
  +         }
  +         return text.toString();
  +        }
  +
  +
  +        /**
  +         * Returns the name.
  +         * @return String
  +         */
  +        public String getName()
  +        {
  +            return name;
  +        }
  +
  +        /**
  +         * Sets the favoriteFood.
  +         * @param favoriteFood The favoriteFood to set
  +         */
  +        public void setFavoriteFood(List favoriteFood)
  +        {
  +            this.favoriteFood = favoriteFood;
  +        }
  +
  +        /**
  +         * Sets the gourmetId.
  +         * @param gourmetId The gourmetId to set
  +         */
  +        public void setGourmetId(int gourmetId)
  +        {
  +            this.gourmetId = gourmetId;
  +        }
  +
  +        /**
  +         * Sets the name.
  +         * @param name The name to set
  +         */
  +        public void setName(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +    }
  +
  +
  +    public static class Salad implements InterfaceFood, Serializable
  +    {
  +        int foodId;
  +        String name;
  +        int calories;
  +        String color;
  +        /**
  +         * Constructor for Salad.
  +         */
  +        public Salad()
  +        {
  +            super();
  +        }
  +
  +        public Salad(String name, int calories, String color)
  +        {
  +            this.name = name;
  +            this.calories = calories;
  +            this.color = color;
  +        }
  +
  +        /**
  +         * @see org.apache.ojb.broker.InterfaceFood#getName()
  +         */
  +        public String getName()
  +        {
  +            return name;
  +        }
  +
  +        /**
  +         * @see org.apache.ojb.broker.InterfaceFood#getCalories()
  +         */
  +        public int getCalories()
  +        {
  +            return calories;
  +        }
  +
  +
  +
  +        /**
  +         * Returns the color.
  +         * @return String
  +         */
  +        public String getColor()
  +        {
  +            return color;
  +        }
  +
  +        /**
  +         * Returns the foodId.
  +         * @return int
  +         */
  +        public int getFoodId()
  +        {
  +            return foodId;
  +        }
  +
  +        public String toString()
  +        {
  +           return "Salad: id = " + foodId + "\n name = " + name +
  +                    "\n calories = " + calories +
  +                    "\n Color = " + color;
  +        }
  +
  +        /**
  +         * Sets the calories.
  +         * @param calories The calories to set
  +         */
  +        public void setCalories(int calories)
  +        {
  +            this.calories = calories;
  +        }
  +
  +        /**
  +         * Sets the color.
  +         * @param color The color to set
  +         */
  +        public void setColor(String color)
  +        {
  +            this.color = color;
  +        }
  +
  +        /**
  +         * Sets the foodId.
  +         * @param foodId The foodId to set
  +         */
  +        public void setFoodId(int foodId)
  +        {
  +            this.foodId = foodId;
  +        }
  +
  +        /**
  +         * Sets the name.
  +         * @param name The name to set
  +         */
  +        public void setName(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +    }
  +
  +    public class Zoo implements Serializable
  +    {
  +        private int zooId;
  +        private String name;
  +        private List animals = new ArrayList();
  +
  +        /**
  +         * Constructor for Zoo.
  +         */
  +        public Zoo()
  +        {
  +            super();
  +        }
  +
  +        public Zoo(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +        public List getAnimals()
  +        {
  +            return animals;
  +        }
  +
  +        public void addAnimal(InterfaceAnimal animal)
  +        {
  +            animals.add(animal);
  +        }
  +
  +        public int getZooId()
  +        {
  +            return zooId;
  +        }
  +
  +        public String toString()
  +        {
  +         StringBuffer text = new StringBuffer("Zoo: id = " + zooId + "\n");
  +         text.append("name = ");
  +         text.append(name);
  +         text.append("\nAnimals:\n");
  +         for(Iterator it = animals.iterator(); it.hasNext();)
  +         {
  +            text.append(it.next().toString());
  +            text.append("\n-------\n");
  +         }
  +         return text.toString();
  +        }
  +
  +        /**
  +         * Returns the name.
  +         * @return String
  +         */
  +        public String getName()
  +        {
  +            return name;
  +        }
  +
  +        /**
  +         * Sets the animals.
  +         * @param animals The animals to set
  +         */
  +        public void setAnimals(List animals)
  +        {
  +            this.animals = animals;
  +        }
  +
  +        /**
  +         * Sets the name.
  +         * @param name The name to set
  +         */
  +        public void setName(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +        /**
  +         * Sets the zooId.
  +         * @param zooId The zooId to set
  +         */
  +        public void setZooId(int zooId)
  +        {
  +            this.zooId = zooId;
  +        }
  +
  +    }
  +
  +
   }
  
  
  
  1.5       +204 -1    db-ojb/src/test/org/apache/ojb/repository_junit_odmg.xml
  
  Index: repository_junit_odmg.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit_odmg.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- repository_junit_odmg.xml	22 Jan 2004 11:09:10 -0000	1.4
  +++ repository_junit_odmg.xml	22 Jan 2004 16:01:19 -0000	1.5
  @@ -854,4 +854,207 @@
           />
      </class-descriptor>
   
  +
  +
  +    <!-- ************************************************* -->
  +    <!-- OQLTest test classes                              -->
  +    <!-- ************************************************* -->
  +    <!-- Definitions for extent org.apache.ojb.broker.InterfaceAnimal -->
  +   <class-descriptor class="org.apache.ojb.odmg.OQLTest$InterfaceAnimal">
  +      <extent-class class-ref="org.apache.ojb.odmg.OQLTest$Mammal" />
  +      <extent-class class-ref="org.apache.ojb.odmg.OQLTest$Reptile" />
  +   </class-descriptor>
  +
  +    <!-- Definitions for extent org.apache.ojb.odmg.OQLTest$InterfaceFood -->
  +   <class-descriptor class="org.apache.ojb.odmg.OQLTest$InterfaceFood">
  +      <extent-class class-ref="org.apache.ojb.odmg.OQLTest$Salad" />
  +      <extent-class class-ref="org.apache.ojb.odmg.OQLTest$Fish" />
  +   </class-descriptor>
  +
  +    <!-- Definitions for org.apache.ojb.odmg.OQLTest$Mammal -->
  +    <class-descriptor
  +      class="org.apache.ojb.odmg.OQLTest$Mammal"
  +      table="MAMMAL"
  +    >
  +    <field-descriptor
  +      name="animalId"
  +      column="animalId"
  +      jdbc-type="INTEGER"
  +      primarykey="true"
  +      autoincrement="true"
  +    />
  +    <field-descriptor
  +        name="name"
  +        column="name"
  +        jdbc-type="VARCHAR"
  +    />
  +    <field-descriptor
  +        name="age"
  +        column="age"
  +        jdbc-type="INTEGER"
  +    />
  +    <field-descriptor
  +        name="numLegs"
  +        column="numLegs"
  +        jdbc-type="INTEGER"
  +    />
  +    <field-descriptor
  +        name="zooId"
  +        column="zooId"
  +        jdbc-type="INTEGER"
  +    />
  +    </class-descriptor>
  +
  +    <!-- Definitions for org.apache.ojb.odmg.OQLTest$Reptile -->
  +    <class-descriptor
  +      class="org.apache.ojb.odmg.OQLTest$Reptile"
  +      table="REPTILE"
  +    >
  +    <field-descriptor
  +      name="animalId"
  +      column="animalId"
  +      jdbc-type="INTEGER"
  +      primarykey="true"
  +      autoincrement="true"
  +    />
  +    <field-descriptor
  +        name="name"
  +        column="name"
  +        jdbc-type="VARCHAR"
  +    />
  +    <field-descriptor
  +        name="age"
  +        column="age"
  +        jdbc-type="INTEGER"
  +    />
  +    <field-descriptor
  +        name="color"
  +        column="color"
  +        jdbc-type="VARCHAR"
  +    />
  +    <field-descriptor
  +        name="zooId"
  +        column="zooId"
  +        jdbc-type="INTEGER"
  +    />
  +    </class-descriptor>
  +
  +    <!-- Definitions for org.apache.ojb.odmg.OQLTest$Zoo -->
  +    <class-descriptor
  +      class="org.apache.ojb.odmg.OQLTest$Zoo"
  +      table="ZOO"
  +    >
  +    <field-descriptor
  +      name="zooId"
  +      column="zooId"
  +      jdbc-type="INTEGER"
  +      primarykey="true"
  +      autoincrement="true"
  +    />
  +    <field-descriptor
  +        name="name"
  +        column="name"
  +        jdbc-type="VARCHAR"
  +    />
  +    <collection-descriptor
  +        name="animals"
  +        element-class-ref="org.apache.ojb.odmg.OQLTest$InterfaceAnimal"
  +        auto-retrieve="true"
  +        auto-update="false"
  +        auto-delete="false"
  +      >
  +        <inverse-foreignkey field-ref="zooId"/>
  +      </collection-descriptor>
  +    </class-descriptor>
  +
  +    <!-- Definitions for org.apache.ojb.odmg.OQLTest$Fish -->
  +    <class-descriptor
  +      class="org.apache.ojb.odmg.OQLTest$Fish"
  +      table="FISH"
  +    >
  +    <field-descriptor
  +      name="foodId"
  +      column="foodId"
  +      jdbc-type="INTEGER"
  +      primarykey="true"
  +      autoincrement="true"
  +    />
  +    <field-descriptor
  +        name="name"
  +        column="name"
  +        jdbc-type="VARCHAR"
  +    />
  +    <field-descriptor
  +        name="calories"
  +        column="calories"
  +        jdbc-type="INTEGER"
  +    />
  +    <field-descriptor
  +        name="typeOfWater"
  +        column="typeOfWater"
  +        jdbc-type="VARCHAR"
  +    />
  +    </class-descriptor>
  +
  +    <!-- Definitions for org.apache.ojb.odmg.OQLTest$Salad -->
  +    <class-descriptor
  +      class="org.apache.ojb.odmg.OQLTest$Salad"
  +      table="SALAD"
  +    >
  +    <field-descriptor
  +      name="foodId"
  +      column="foodId"
  +      jdbc-type="INTEGER"
  +      primarykey="true"
  +      autoincrement="true"
  +    />
  +    <field-descriptor
  +        name="name"
  +        column="name"
  +        jdbc-type="VARCHAR"
  +    />
  +    <field-descriptor
  +        name="calories"
  +        column="calories"
  +        jdbc-type="INTEGER"
  +    />
  +    <field-descriptor
  +        name="color"
  +        column="color"
  +        jdbc-type="VARCHAR"
  +    />
  +
  +    </class-descriptor>
  +
  +
  +    <!-- Definitions for org.apache.ojb.odmg.OQLTest$Gourmet -->
  +    <class-descriptor
  +      class="org.apache.ojb.odmg.OQLTest$Gourmet"
  +      table="GOURMET"
  +    >
  +    <field-descriptor
  +      name="gourmetId"
  +      column="gourmetId"
  +      jdbc-type="INTEGER"
  +      primarykey="true"
  +      autoincrement="true"
  +    />
  +    <field-descriptor
  +        name="name"
  +        column="name"
  +        jdbc-type="VARCHAR"
  +    />
  +     <collection-descriptor
  +         name="favoriteFood"
  +         element-class-ref="org.apache.ojb.odmg.OQLTest$InterfaceFood"
  +         auto-retrieve="true"
  +         auto-update="false"
  +         indirection-table="GOURMET_FOOD"
  +      >
  +         <fk-pointing-to-this-class column="GOURMET_ID"/>
  +         <fk-pointing-to-element-class column="FOOD_ID"/>
  +      </collection-descriptor>
  +    </class-descriptor>
  +
  +
   <!-- Mapping of classes used in junit tests and tutorials ends here -->
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message