Natural key or OID key for findByPrimaryKey ?

Discussions

EJB programming & troubleshooting: Natural key or OID key for findByPrimaryKey ?

  1. Natural key or OID key for findByPrimaryKey ? (1 messages)

    In my database, all tables have a OID column to identifiate each row.
    These OID are generated throught a UUID algorithm.
    I 've heard that OID should be hidden to the client Application.
    So, must I use :
         + Contract findByPrimaryKey (String OID);

    xor + Contract findByPrimaryKey (Long contractID) where contractID is a beasness meaning key ?

    Thanks for your comment.
  2. Hi,

    To me it does not make too much of a difference. Yes the client should not be aware of the UUID by your developers should be. Use what you are storing in the referencing tables. That way you avoid round trips. If code is never to be changed then suggest using that, since size would be smaller (I hope). Preferably thing of using integers. Otherwise the application perf would always be wanting.

    All the best.