Re: Uniqueness of attributes ...

Markus Ruggiero <[email protected]> Mon, 3 May 2004 17:03:37 +0200
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <p06100503bcbc0f1e60c5@[192.168.56.11]>
Hi,

The only relyable way to do this is to have a unique index on that 
particular attribute in your database. EOF will then throw an 
Exception (it'll be an exception coming from the adapter). You must 
then parst the exception message for the particular error 
message/error code that your DB returns. As far as I know there is no 
generic EOF way to do this

---markus---

At 17:15 Uhr +0800 3.5.2004, Ashley Aitken wrote:
>Howdy All,
>
>I need to ensure a non-primary key (non-foreign key) attribute is unique.
>
>The "obvious" way of doing this is to do a fetch on that property 
>when validating the attribute to see if any records currently exist 
>with that value.
>
>Is that the best way of doing it (with EOF)?   Surely "another 
>process" could enter a row with that value between when I fetch to 
>check and then save the row ...
>
>Is there someway of telling the database (generically) that this 
>attribute should be unique, and it automatically causing an 
>exception if a duplicate value is saved.
>
>I don't want to get into database specifics, I want to keep this at 
>the EOF level.
>
>Thanks,
>Ashley.
>
>--
>Ashley Aitken
>Perth, Western Australia
>mrhatken at mac dot com
>
>_______________________________________________
>EOF mailing list
>[email protected]
>http://www.omnigroup.com/mailman/listinfo/eof


-- 
Markus Ruggiero
rucotec consulting and technologies    email     mailto:[email protected]
rucotec GmbH                                web       http://www.rucotec.ch
Steinentorstrasse 8            
4051 Basel                                  Mobile    +41 (0)79 508 4701
Switzerland                                 Phone/Fax +41 (0)61 271 4990