Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 44668 invoked from network); 20 Sep 2007 17:46:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Sep 2007 17:46:41 -0000 Received: (qmail 1671 invoked by uid 500); 20 Sep 2007 17:46:30 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 1659 invoked by uid 500); 20 Sep 2007 17:46:30 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 1648 invoked by uid 99); 20 Sep 2007 17:46:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Sep 2007 10:46:30 -0700 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 [68.142.200.151] (HELO web30808.mail.mud.yahoo.com) (68.142.200.151) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 20 Sep 2007 17:46:29 +0000 Received: (qmail 12233 invoked by uid 60001); 20 Sep 2007 17:46:08 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=pXkuxsUDwJMrkbwUT+JJOuoPfvH6a9M4XSU+nhAivE1i3IrCIIVFdLYNNI1nprvqxmEItLEPdrJYSTUn6E4TSpsxKmp4iC/1UYxBj7OSYNyf6z1AJNQ3Sv87inXZ1xO+0tejg7hypOcF/97+v030Fd7+u8pvon/+VYrCpgNKzCE=; X-YMail-OSG: 3Tp.tKwVM1mezsadhlWWdo0sAo1rpUk5.KV6XXTogUIFxt.GmGKhIDcxN__LQNIM8pYEzSettw-- Received: from [12.171.160.202] by web30808.mail.mud.yahoo.com via HTTP; Thu, 20 Sep 2007 10:46:08 PDT Date: Thu, 20 Sep 2007 10:46:08 -0700 (PDT) From: Robert Glover Subject: Abator problem updating table with unique key constraint but no primary keay To: user-java@ibatis.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <576830.11999.qm@web30808.mail.mud.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org The Abator update shown below will not compile because Abator will not generate the "updateByPrimary" method. The reason Abator will not generate the "updateByPrimary" method is that the table has a "unique" constraint on a column but does not define that column as being a primary key. (The table has no primary key defined at all). I cannot solve this problem by dropping the "unique" constraint and replacing it with a primary key definition on the same column. There are two reasons why I can't. First, because an "ALTER" statement to define a primary key fails because there is already a "unique" constraint defined. Second, because an "ALTER" to drop the "unique" constraint fails due to there being foreign keys in other tables that reference that column. Here is the Abator method I cannot compile because Abator does not generate the method due to their being no primary key: getIatMidOrgStructureDAO().updateByPrimary(iatMidOrgStructure2); Is there any change I can make to the Abator XML to force it to generate that method. A second question I have is that I do not fully understand the difference between the Abator method "updateByPrimaryKey" versus the Abator method "updateByPrimaryKeySelective". My guess is that the latter only creates "SET" statements for columns that have a non-null value. tx (and tx for the answer to a previous question about surrounding column names with literals, a feature that will appear in an upcoming Abator release), Robert