Re: [Modeler] DbEntity:Primery Key:PK Generation Strategy - Is there any option for natural primary key?

From: Aristedes Maniatis (ar..aniatis.org)
Date: Thu Sep 10 2009 - 19:02:32 EDT

  • Next message: Aristedes Maniatis: "Re: Using Join Table"

    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.

    Ari

    -- 
    

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



    This archive was generated by hypermail 2.0.0 : Thu Sep 10 2009 - 19:03:26 EDT