Correct - ID is referring to the primary key in the table. If I insert a data point(date, id, value), it is possible that I will update this point at a later date. I can manually check in code for existence of the date, id pair, though I was wondering if there was another way to do this, or if there was already a way to impose such a constraint.
- Luis
On Tue, Aug 10, 2010 at 2:37 PM, Oleg Broytman
<phd@phd.pp.ru> wrote:
On Tue, Aug 10, 2010 at 02:16:26PM -0400, luis cota wrote:
> How can I ensure that there exists only one value for a given Date, ID pair?
In general, by creating a unique index on (date, id) pairs; you can
create the index directly in SQL or in SQLObject.
But in this particular case... you say ID - do you mean the primary key
for the table? Well, it's itself a unique key, you don't need to make
(date, id) pairs more unique.
Oleg.
--
Oleg Broytman http://phd.pp.ru/ phd@phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss