Hello, I tried to use a Thread-Bound DataContext with Cayenne 2.0.3 (http://cwiki.apache.org/CAYDOC/obtaining-datacontext.html):
[code] public DataContext getDataContext() { try { logger.debug("trying to get threaded-data-context for thread " + Thread.currentThread()); return DataContext.getThreadDataContext(); } catch (IllegalStateException e) { logger.debug("no threaded data-context, creating one"); DataContext context = DataContext.createDataContext(); logger.debug("binding new dataContext to current-thread " + Thread.currentThread()); DataContext.bindThreadDataContext(context); return context; } } [/code] But with this construct I noticed the following behaviour: If I'm sending a "wrong" INSERT-statement by the web-frontend the first time I will get a right error/exception (MysqlDataTruncation). Afterwards I send again a second request with a right dataset to be inserted in the DB which would not fail normally. But because of the threaded dataContext the old/first task (which is wrong) is still binded in the second request. Here is the part of the log for the second request: [log] 2007-10-15 13:06:14,921 [http-8080-2] [INFO ] [] QueryLogger - INSERT INTO insured_event (accessory, all_data_complete, article_number, collection_date, confirmation_of_receipt, contract_id, contribution_customer_amount, contribution_tariff_amount, cover_note_date, created, customer_id, damage_category_id, damage_date, device_provider, device_type, event_state_id, imei, incoming_date, insured_event_closed_date, insured_event_type_id, police_reference, police_report, repair_cost_amount, subst_device_provider, subst_device_type, updated, valuation_price_amount, workflow_reference) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2007-10-15 13:06:14,937 [http-8080-2] [INFO ] [] QueryLogger - [bind: '', 'false', NULL, NULL, 'false', 'AEkARAAjAE0AQwBbADEAMgAzADAAOAAyADgAXQAA..', NULL, 326.0, NULL, '2007-10-15 13:06:04.578', 'AEkARAAjAE0AQwBbADMAMgAyADcAMwA1ADYAXQAA..', 3, NULL, NULL, NULL, 4, '351453207158847', '2007-10-16 00:00:00.0', NULL, 2, '', 'false', NULL, NULL, NULL, '2007-10-15 13:06:04.578', NULL, NULL] 2007-10-15 13:06:14,937 [http-8080-2] [INFO ] [] QueryLogger - === updated 1 row. 2007-10-15 13:06:14,937 [http-8080-2] [INFO ] [] QueryLogger - [bind: '', 'false', NULL, NULL, 'false', 'AEkARAAjAE0AQwBbADEAMgAzADAAOAAyADgAXQAA..', NULL, 5000.0, NULL, '2007-10-15 13:05:44.734', 'AEkARAAjAE0AQwBbADMAMgAyADcAMwA1ADYAXQAA..', 3, NULL, NULL, NULL, 4, '351453207158847', '2007-10-16 00:00:00.0', NULL, 2, '', 'false', NULL, NULL, NULL, '2007-10-15 13:05:44.734', NULL, NULL] 2007-10-15 13:06:14,953 [http-8080-2] [INFO ] [] QueryLogger - *** error. com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated; out of range for column 'contribution_tariff_amount' at row 1 [/log] The value "326.0" is right and "5000.0" is the wrong one. Is this a bug or an excepted behaviour? Is this reproducible for you? BTW: The servlet filter in the web.xml is set in this scenario (http://cayenne.apache.org/doc20/web-applications.html). Thanks for help! Oilid