Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 86565 invoked from network); 28 Nov 2007 09:00:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Nov 2007 09:00:11 -0000 Received: (qmail 81245 invoked by uid 500); 28 Nov 2007 08:59:58 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 81238 invoked by uid 500); 28 Nov 2007 08:59:58 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 81229 invoked by uid 99); 28 Nov 2007 08:59:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Nov 2007 00:59:58 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [194.97.108.43] (HELO FNHH-SVMEXFE002.Freenet-AG.de) (194.97.108.43) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Nov 2007 08:59:35 +0000 Received: from FNHH-SVMEXDB003.Freenet-AG.de ([195.4.20.142]) by FNHH-SVMEXFE002.Freenet-AG.de with Microsoft SMTPSVC(6.0.3790.1830); Wed, 28 Nov 2007 09:59:34 +0100 x-mimeole: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Cayenneand Thread-Bound DataContext Date: Wed, 28 Nov 2007 09:59:33 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Cayenneand Thread-Bound DataContext Thread-Index: AcgxnTgfcHmjVNsMQVuzFjXCM+IZ2Q== From: "Oilid Adsi" To: X-OriginalArrivalTime: 28 Nov 2007 08:59:34.0274 (UTC) FILETIME=[FEFD6E20:01C8319C] X-Virus-Checked: Checked by ClamAV on apache.org 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 =3D 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 - =3D=3D=3D 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