cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: commit doesn't work with performIteratedQuery
Date Thu, 26 Jul 2012 06:27:29 GMT
Talking of SQLite limitations, I wonder if SQLite prevents commit when a read is in progress?
While you are inside 'performIteratedQuery', you have a Connection bound to the current thread.
When you are committing, this connection is reused while ResultSet is still open. Not sure
what are the consequences with SQLite. (I wish it would throw an exception at least if it
can't handle that).

Maybe try forcing Cayenne to open a second connection by wrapping commit in a custom transaction.
See "User-Defined Transaction

While this may stumble onto some concurrency limits of SQLite, it is probably worth a try.


On Jul 26, 2012, at 1:42 AM, Aristedes Maniatis wrote:

> On 26/07/12 12:16am, Joel Becker wrote:
>> Hello,
>> I am using performIteratedQuery(new SelectQuery(clazz)) and
>> objectFromDataRow(). I make changes to each object, but commitChanges() is
>> not committing the changes :( . I can see the queries logged:
>> 2012-07-25 09:12:58,835 [main] INFO  org.apache.cayenne.access.QueryLogger
>>  - --- will run 1 query.
>> 2012-07-25 09:12:58,835 [main] INFO  org.apache.cayenne.access.QueryLogger
>>  - UPDATE xprecinct_part SET reporting_unit_id = ? WHERE vr_id = ?
>> 2012-07-25 09:12:58,835 [main] INFO  org.apache.cayenne.access.QueryLogger
>>  - [bind: 1->reporting_unit_id:72, 2->vr_id:'20815']
>> 2012-07-25 09:12:58,835 [main] INFO  org.apache.cayenne.access.QueryLogger
>>  - === updated 1 row.
>> But when I open the SQLite database file I'm committing to, the changes
>> have not taken effect. Any ideas why?
> Interestingly we've just been talking about SQlite. Support for this database is patchy
at best and it doesn't pass all the unit tests in Cayenne, because SQlite doesn't support
the full SQL specification. But the simple UPDATE you have above should work.
> Since your database is not throwing errors, is it silently swallowing them? Do you have
write permissions? Is the database in a read/write location. Can you execute these queries
by hand with the same user/pass?
> If you need a simple lightweight database which just works without fuss, can I suggest
> Ari
> -- 
> -------------------------->
> Aristedes Maniatis
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message