cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <>
Subject Re: [Modeler] DbEntity:Primery Key:PK Generation Strategy - Is there any option for natural primary key?
Date Thu, 10 Sep 2009 23:02:32 GMT
On 10/09/09 10:37 PM, gilbertoca wrote:
> Are you saying that even though my table has the primary key - it doesn't
> matter natural or surrogate key - cayenne won't ensure that it is unique?

If you are creating your own keys, it is your responsibility to create a way to generate unique
keys. This is the expected behaviour: you either use Cayenne or the db to guarantee you unique
keys, or it is up to you to find a way to ensure they are unique. If this is a user enterable
field, you could use Cayenne's validation API to help catch the problem, or you could try
to catch the db error you get when you commit. Either way you need to be aware of how this
works in a threaded multi-user environment.

> One more question. While creating my DbEntities I didn't see an option for
> Unique Key Constraint. Is it a manual task?

Correct. Cayenne modeler does not currently manage database indexing.



Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message