Package org.apache.ojb.otm

Examples of org.apache.ojb.otm.Person


        if (!this.pm.isClosed()) this.pm.close();
    }

    public void _testOneVariableSubstitution()
    {
        Person p = new Person("George", "Harrison");
        pm.currentTransaction().begin();
        pm.makePersistent(p);
        pm.currentTransaction().commit();

        pm.evictAll();

        pm.currentTransaction().begin();
        Query q = pm.newQuery(Person.class);
        q.declareVariables("java.lang.Integer pid");
        q.declareImports("org.apache.ojb.otm.Person");
        q.setFilter( "id == pid");
        Collection results = (Collection) q.execute(new Integer(p.getId()));

        assertNotNull(results);
        assertEquals(1, results.size());
        Person same = (Person) results.iterator().next();
        assertEquals(p.getId(), same.getId());
       
        pm.currentTransaction().commit();
    }
View Full Code Here


    /** Cheat and use our impl directly */
    private PersistenceManagerFactoryImpl factory = new PersistenceManagerFactoryImpl();

    public void testLoadExtent() throws Exception
    {
        Person article = new Person();
        PersistenceManager pm = factory.getPersistenceManager();
        Transaction tx = pm.currentTransaction();
        tx.begin();
        pm.makePersistent(article);
        tx.commit();
View Full Code Here

TOP

Related Classes of org.apache.ojb.otm.Person

Copyright © 2018 www.massapicom. 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.