ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Glover <robertglove...@yahoo.com>
Subject Abator problem updating table with unique key constraint but no primary keay
Date Thu, 20 Sep 2007 17:46:08 GMT
   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:


      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),

View raw message