Hi,
we have the same problem and solve it by clearing the object cache, thus the
application must re-read the data from the database and gets the current data.
I don't know whether this is a 'clean' solution or a bit of a hack - until now it
works fine.
(if someone has concerns about it, pleas let me know).
We trigger this action by a button in our web application, it is *not* triggered
automaticall (by a database event or something like that) when the values in the
database change.
Out solution:
public void clearCache() throws PersistenceException
{
Transaction tx = newTransaction();
tx.begin();
((OdmgTransactionImpl)
tx).getTransactionImpl().getBroker().serviceObjectCache().clear();
tx.commit();
}
Mayby this is a solution for you.
Regards
Max
> -----Urspr�ngliche Nachricht-----
> Von: Mykola Ostapchuk [mailto:[EMAIL PROTECTED]
> Gesendet: Samstag, 28. Juni 2003 00:34
> An: OJB Users List
> Betreff: 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!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]