Re: Unique attributes
Re: Unique attributes
- Subject: Re: Unique attributes
- From: Ian Joyner <email@hidden>
- Date: Wed, 15 Feb 2006 15:01:04 +1100
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
Chuck
On 15/02/2006, at 10:14 AM, Ian Joyner wrote:
Thanks for confirming my suspicions. I think I will submit a bug/
NFR about this. Has anyone else done so?
Ian
On 14/02/2006, at 5:25 PM, Robert Walker wrote:
but this is like a low-level non-functional performance tuning
solution, rather than being in the semantics of the model. Is
there a way to set unique on a column in EOModeler?
As far as I know there is not. You will still need to do some
database configuration/optimization in your database. At least
that's what I've always done.
--
Robert Walker
email@hidden
There are 10 types of people in the world, those who count in
binary, and those who don't.
On Feb 14, 2006, at 1:02 AM, Ian Joyner wrote:
Primary keys seem to be the only things that EOModeler counts
as unique. However, I want other columns in the DB to be
unique, particularly 'usercode'. I have modified this with SQL:
alter table USER column USERCODE set unique index;
but this is like a low-level non-functional performance tuning
solution, rather than being in the semantics of the model. Is
there a way to set unique on a column in EOModeler?
Ian Joyner
Sportstec
_______________________________________________
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