Package org.exolab.castor.jdo

Examples of org.exolab.castor.jdo.Database.begin()


    }

    public void testLoadTruck() throws Exception {
        Database database = _category.getDatabase();
       
        database.begin();
        Truck truck = (Truck) database.load(Truck.class, new Integer(5));
        database.commit();
       
        assertNotNull(truck);
        assertEquals(5, truck.getId());
View Full Code Here


    }

    public void testLoadCar() throws Exception {
        Database database = _category.getDatabase();
       
        database.begin();
        Object object = database.load(Car.class, new Integer(5));
        assertNotNull (object);
        assertEquals ("ctf.jdo.tc9x.Truck", object.getClass().getName());
        Truck truck = (Truck) object;
        database.commit();
View Full Code Here

    }

    public void testCreateAndLoadCar() throws Exception {
        Database database = _category.getDatabase();

        database.begin();
        Order order = new Order();
        order.setId(11);
        order.setName("order 11");
        database.create(order);
        database.commit();
View Full Code Here

     * Test method.
     * @throws Exception For any exception thrown.
     */
    public void testQuerySortedCollection() throws Exception {
        Database db = _category.getDatabase();
        db.begin();
       
        OQLQuery query = db.getOQLQuery("SELECT c FROM "
                + SortedContainer.class.getName() + " c WHERE id = $1");
        query.bind(new Integer(1));
        QueryResults results = query.execute();
View Full Code Here

        order.setId(11);
        order.setName("order 11");
        database.create(order);
        database.commit();
       
        database.begin();
        ProductDetail detail = new ProductDetail();
        detail.setId(11);
        detail.setCategory("category 11");
        detail.setLocation("location 11");
        database.create(detail);
View Full Code Here

        detail.setCategory("category 11");
        detail.setLocation("location 11");
        database.create(detail);
        database.commit();
       
        database.begin();
        Truck truck = new Truck();
        truck.setId(11);
        truck.setName("truck 11");
        truck.setKw(112);
        truck.setMake("Fiat");
View Full Code Here

        Collection orders = new LinkedList();
        orders.add(database.load(Order.class, new Integer(11)));
        truck.setOrders(orders);
        database.commit();
       
        database.begin();
        Object object = database.load(Car.class, new Integer(11));
        assertNotNull(object);
        assertEquals("ctf.jdo.tc9x.Truck", object.getClass().getName());
        Truck loadedTruck = (Truck) object;
        database.commit();
View Full Code Here

        database.commit();
       
        assertNotNull(loadedTruck);
        assertEquals(11, loadedTruck.getId());
       
        database.begin();
        database.remove(database.load (Car.class, new Integer(11)));
        database.remove(database.load (ProductDetail.class, new Integer(11)));
        database.remove(database.load(Order.class, new Integer(11)));
        database.commit();
       
View Full Code Here

    }

    public void testLoadOwner() throws Exception {
        Database database = _category.getDatabase();
       
        database.begin();
        Owner owner = (Owner) database.load(Owner.class, new Integer(1));
        database.commit();
       
        assertNotNull(owner);
        assertEquals(1, owner.getId().intValue());
View Full Code Here

    }
  
    public void testLoadM() throws Exception {
        Database database = _category.getDatabase();
       
        database.begin();
        M m = (M) database.load(M.class, new Integer(1));
        database.commit();
       
        assertNotNull(m);
        assertEquals(1, m.getId());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.