Hi,
i have a problem with refreshing of cached objects.
I do something like this:
SelectQuery query = new
SelectQuery(de.freenet.cayenne.kontingent.Customer.class,
Expression.fromString("cid = " + cid));
List list = context.performQuery(query);
Customer customer = list.get(0);
List accounts = c.getAccounts();
Account a = accounts.get(0);
a.setAmount(amount);
context.commitChanges();
I am using Optimistic Locking on the Account Object and what I need to do is to
catch the OptimisticLockException which may be thrown and redo the steps again.
So if the data of the Account is changed within the database while I am using
it I want to reload the customer and all it's related objects and try again.
My problem is that after the OptimisticLockException is thrown the data within
the Account object is not reloaded from the database. I tried to use
query.setRefreshingObject(true);
but still no changes.
In the logging file I see that cayenne entries like this:
SELECT t0.cid, t0.last_updated, t0.login, t0.next_cycle_date, t0.rec_change,
t0.rec_create, t0.suspended, t0.id, t0.mandant_id FROM customer t0 WHERE t0.cid
= ? [bind: 7]
SELECT t0.activation_date, t0.amount, t0.credit_limit, t0.expire_date,
t0.next_cycle_date, t0.rec_change, t0.rec_create, t0.account_type_id,
t0.customer_id, t0.id, t0.unit_id FROM account t0 WHERE t0.customer_id = ?
[bind: 797380]
But the objects I get still contain the old data and I keep getting
OptimisticLockExceptions. How do I tell cayenne to reload the customer and all
it's related object from the database???
I am using cayenne 1.2.1, with shared caching and JavaGroups.
Thanx
Ayhan Kondoz
Ayhan Kondoz
Software-Entwicklung
----------------------------------------------------------------------------------
Telefon: +49 (0) 40 513 06 616
Telefax: +49 (0) 40 513 06 998 616
E-Mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Website: http://www.freenet.de <http://www.freenet.de/> ;
http://www.freenet-ag.de <http://www.freenet-ag.de/>
----------------------------------------------------------------------------------
freenet.de AG
Deelbögenkamp 4c
22297 Hamburg
----------------------------------------------------------------------------------
Vorsitzender des Aufsichtsrates: Prof. Dr. Helmut Thoma
Vorstand: Eckhard Spoerr (Vors.),
Axel Krieger, Stephan Esch, Eric Berger
Amtsgericht Hamburg HRB 74048
Diese Information ist ausschließlich für die adressierte Person oder
Organisation bestimmt und könnte vertrauliches und/oder privilegiertes Material
enthalten. Personen oder Organisationen, für die diese Information nicht
bestimmt ist, ist es nicht gestattet, diese zu lesen, erneut zu übertragen, zu
verbreiten, anderweitig zu verwenden oder sich durch sie veranlasst zu sehen,
Maßnahmen irgendeiner Art zu ergreifen. Sollten Sie diese Nachricht irrtümlich
erhalten haben, bitten wir Sie, sich mit dem Absender in Verbindung zu setzen
und das Material von Ihrem Computer zu löschen.
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material. Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error, please contact
the sender and delete the material from any computer.