Re: Unique attributes
Re: Unique attributes
- Subject: Re: Unique attributes
- From: Ian Joyner <email@hidden>
- Date: Wed, 15 Feb 2006 15:44:11 +1100
Thinking on it a little further and an afternoon walk (now I need my
afternoon nap), perhaps unique is not as high in the semantic chain
as we would like, since identifying candidate keys in relations
implies unique across the set of attributes in the key. This would
help in being able to identified if things were normalized into at
least 3NF or BCNF or where to denormalize for performance reasons.
That way, I think EOModeler could be made into a much more useful
tool than just the ER approach it supports and people may be
normalizing things and doing good design without realizing it! (OK, I
have to reread the books on normalization everytime :-()
Ian
On 15/02/2006, at 3:01 PM, Ian Joyner wrote:
On 15/02/2006, at 1:11 PM, Chuck Hill wrote:
Hello Ian,
On Feb 14, 2006, at 5:44 PM, Ian Joyner wrote:
If I were to request a UNIQUE property in EOModeler, should this
be on a per-table basis (which would set UNIQUE against the
column in the underlying database), or on an EO entity (in the
case of single table inheritance, you would not want the column
to be UNIQUE because this may not be guaranteed between entities)?
Any thoughts?
Well, I think this may be why it was omitted from EOF. :-) It is
easy to do without inheritance. Single table inheritance is
possible provided that your database can support unique indexes
across two or more columns.
So, you would have to make the unique on the entity type column +
the column you wanted to be unique within each subclass entity, ie,
a candidate key for the records. Doesn't look like OpenBase will do
that, which I must admit I was surprised when I was looking at this
the other day.
I am not sure how you could implement it for vertical
inheritance at the database level unless you resorted to
triggers / stored procedures and queries. Horizontal inheritance
should not present a problem. And if you don't implement it at
the pinch point of the database level, how do you ensure
uniqueness across instances.
That certainly would be a killer if your columns for the candidate
key came from different tables.
Assuming that a technical solution can be found, the right place
to implement this is on a EO entity basis rather than a table
basis. And for good measure, sub classes can't make an inherited
unique attribute non-unique.
I agree, I think the unique check should be done at the EO level,
like the check for null is, but performance might be abysmal if
there is no underlying DB support for multi-column uniques. EO
gives better error messages, which is less scary for the user.
Ian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden