Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 24041 invoked from network); 26 Oct 2007 23:38:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2007 23:38:39 -0000 Received: (qmail 42403 invoked by uid 500); 26 Oct 2007 23:38:27 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 42252 invoked by uid 500); 26 Oct 2007 23:38:27 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 42243 invoked by uid 99); 26 Oct 2007 23:38:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 16:38:27 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of michael.d.dick@gmail.com designates 209.85.146.183 as permitted sender) Received: from [209.85.146.183] (HELO wa-out-1112.google.com) (209.85.146.183) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 23:38:30 +0000 Received: by wa-out-1112.google.com with SMTP id m28so1305401wag for ; Fri, 26 Oct 2007 16:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; bh=ndFKTR/KZ6HdRZIONFJ7Y86JVMFP/v6Xu5McmqS7ahs=; b=SbVmrP0ru6s3L3Clf2ENvWw7A3w0pl1mRLO4EoylS/PzDM12No/qcQWMeWkRuzEqmUunjGaxO9ntsn1r6+vWEbX7XlnIbnHf2+elVMq2JgYB+jnI2x2t1SXX1PmbHbbts+2zNcIqLhifAAV5emqyWfrkwLFtlXge1mtuelmGC4c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; b=RfQq4c6Rolt9tCcSpaES22L6A6UcaXTPPZ7x5tOq/tF1Lo4yFUWNtHqeJ61qLnylWjxeoHy7yqETWK7hAl06CL3ZQgcdJ0UTcBd5PRMG3Tzamx/firHK8z2syLXMtw2kQ5dhBtQ5cnovKgOEOJIr8IRTOPIPKqHmmk/KalvKnaA= Received: by 10.115.76.1 with SMTP id d1mr4034377wal.1193441880554; Fri, 26 Oct 2007 16:38:00 -0700 (PDT) Received: by 10.114.200.3 with HTTP; Fri, 26 Oct 2007 16:38:00 -0700 (PDT) Message-ID: <72c1350f0710261638yedf4f8ci78ead2548b408e17@mail.gmail.com> Date: Fri, 26 Oct 2007 18:38:00 -0500 From: "Michael Dick" Sender: michael.d.dick@gmail.com To: dev@openjpa.apache.org Subject: Sequence table problems with SQLServer MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8361_28400912.1193441880555" X-Google-Sender-Auth: 6e7649a6658de390 X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_8361_28400912.1193441880555 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I've run into tricky issue with Sequence tables on SQLServer. After some time during a stress test I get this exception when trying to update the sequence table: openjpa.jdbc.SQL: Trace: executing prepstmnt 4953425 SELECT SEQUENCE_VALUE FROM OPENJPA_SEQUENCE_TABLE WHERE ID = ? [params=(int) 0] . . . openjpa.jdbc.SQL: Trace: executing prepstmnt 19626156 UPDATE OPENJPA_SEQUENCE_TABLE SET SEQUENCE_VALUE = ? WHERE ID = ? AND SEQUENCE_VALUE = ? [params=(long) 48601, (int) 0, (long) 48551] . . . java.sql.SQLException: [IBM][SQLServer JDBC Driver][SQLServer]Transaction (Process ID 85) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. at com.ibm.websphere.jdbc.base.BaseExceptions.createException(Unknown Source) at com.ibm.websphere.jdbc.base.BaseExceptions.getException(Unknown Source) . . . at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate (DelegatingPreparedStatement.java:269) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate (LoggingConnectionDecorator.java:856) I believe I'm hitting the exception because SQLServer doesn't support the FOR UPDATE clause. Normally the first SQL statement shown above would have locked the row preventing the deadlock. SQLServer does support the WITH (UPDLOCK) hint, but I haven't found a convenient way to isolate the change so that it only affects TableSequences. Has anyone else run into this problem, or is there a better way to solve it (than using WITH (UPDLOCK))? -Mike ------=_Part_8361_28400912.1193441880555--