db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Palomares <rpmdisguise-j...@yahoo.es>
Subject Re: SQL Exception on trying to add some foreign keys constraints with DdlUtils
Date Mon, 28 May 2007 20:46:28 GMT
Thomas Dudziak escribió:
> On 5/23/07, Ricardo Palomares <rpmdisguise-java at yahoo.es> wrote:
>> Anyway, I'm using DdlUtils to keep updated the database schema of a
>> desktop application without me or my users having to run SQL commands.
>> (...)
> Derby requires that the columns in the referenced table are part of
> the primary key or unique. Note that this is the unique column
> constraint, not the unique index
> (http://db.apache.org/derby/docs/10.2/ref/rrefsqlj16095.html#rrefsqlj16095).
> DdlUtils currently cannot create unique columns (a feature request for
> 1.1), so with DdlUtils the columns have to be part of the primary key.

First of all, sorry for the late followup.

Since I'm not going to stop using DdlUtils (too useful to me, thank
you!) :-) what do you think would be the smarter move on my part? I'm
assuming DdlUtils 1.1 is still far away so sit and wait is not an
option for me. If L10N table has these fields:

<table name="L10N">
  <column name="ID" primaryKey="true" required="true" type="INTEGER"
   size="10" autoIncrement="true"/>
  <column name="L10NCODE" primaryKey="false" required="true"
   type="VARCHAR" size="10" autoIncrement="false"/>
  (...other internal fields...)
  <unique name="L10N_BY_CODE">
    <unique-column name="L10NCODE"/>

would it be OK if I just turn L10NCODE on as part of the primary key?
(It looks a bit weird to me, to be honest).

Actually, I put ID there just to have a primary key definition in a
consistent way through the whole database, but I could well live with
L10NCODE being the PK (and completely drop ID field in that table),
since it will be unique by design and the table itself would likely
never grow up over 100 records (being 2 or 3 the more usual figure).

Sorry for slipping into OT here. I'm fairly new to relational database
design and still learning what is considered sensible and what plain
bad design.


View raw message