You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Mykola Ostapchuk <my...@sympatico.ca> on 2003/06/28 00:33:56 UTC

Getting refreshed data from DB

Hello,

I need help to force OJB to get data from database.
My problem: when I insert/modyfy/delete records manually from MySql console,
OJB keeps previous Vector of results (during running Tomcat).
Only after restarting Tomcat I can see "updated" records in my browser.
I thougth setting refresh="true" in class-descriptor will help, but it
didn't...

DAO:
            Criteria criteria = new Criteria();
            criteria.addOrderBy("CO_order");
            criteria.addOrderBy("CO_name");
            System.out.println("Critiera:" + criteria.toString());
            Query query = QueryFactory.newQuery(CountriesVO.class,
criteria);
            query.setStartAtIndex(1);
            broker = ServiceLocator.getInstance().findBroker();
            results = (Vector) broker.getCollectionByQuery(query);


Table mapping:

<class-descriptor class="com.iprs.web.countries.CountriesVO"
table="countries" refresh="true">
     <field-descriptor id="1" name="countryId" column="CO_id"
jdbc-type="BIGINT"  primarykey="true" autoincrement="true"/>
     <field-descriptor id="2" name="countryName" column="CO_name"
jdbc-type="VARCHAR"/>
     <field-descriptor id="3" name="countryOrder" column="CO_order"
jdbc-type="VARCHAR"/>
     <field-descriptor id="4" name="countryActive" column="CO_active"
jdbc-type="VARCHAR"/>
</class-descriptor>

Please, help!