Thanks all for your responses.
OK now I've thought this through for a bit and I agree that Cayenne
shouldn't be doing the DB work for this. Thanks for the clarifications
on my initial thoughts of getting Cayenne to automate what I would
*perhaps* have to do manually.
While I'm getting out of my depth here, I still wonder if the Cayenne
modeller should define the index options for a DB Entity.
This still lets the DB do the work and the developer can define the
(in my case the unique index/constraint) in the modeller knowing that
the DB will
have the constraint in place. The developer wouldn't have to worry
maintaining indexes for different DB types and ensuring that the index
If I set a unique index now and try to insert, I'll get an
Exception...right? So I'm a little unsure as to why there'd be a
need to check all possible DB error codes and track possible changes
between releases of both DB and JDBC driver (though probably nice to
have). Could we just use
the same exception mechanism?
I could manually set a unique index on my DB, but from a selfish lazy
user perspective this is maintenance. I could maintain a script of
indexes. But what if I want to move to a new db that has a different
Sorry if all this sounds like the ravings of a madman but its just my
----- Original message -----
From: "Andrus Adamchik" <andru..bjectstyle.org>
Date: Tue, 5 Oct 2004 19:22:53 -0400
Subject: Re: Unique fields
Trying to answer a few emails in this thread at once ;-)
On Oct 5, 2004, at 10:22 AM, Gentry, Michael wrote:
> I could see an option for putting it in the model for the purpose of
> schema creation
That's the only thing I had in mind when proposing to open a ticket in
JIRA. I definitely have no intentions to force Cayenne doing the DB
On Oct 5, 2004, at 10:52 AM, Cris Daniluk wrote (also mentioned by
> Why not let the database do it and simply have the db adapters better
> equipped to handle the unique constraint exception? Oracle, PG, MySQL
> all have a unique constraint and all throw a consistent (though
That's an interesting idea, however this is also lots of maintenance
burden to keep an internal mapping of all possible DB error codes and
track possible changes between releases of both DB and JDBC driver. So
it will be hard to achieve consistency here...
This archive was generated by hypermail 2.0.0 : Wed Oct 06 2004 - 05:32:13 EDT