Re: Id problem when trying to make a component decoupling a module

From: Aristedes Maniatis (ar..aniatis.org)
Date: Mon Oct 05 2009 - 03:43:10 EDT

  • Next message: Borut Bolčina: "Re: SQLTemplate with SQL MAX function"

    On 5/10/09 3:31 PM, han..elinux.cl wrote:
    > The problem is when we try to set the id in a class using the workflow it gives me the aforementioned message of temporary id. I don't want to commit in the middle like i did before in order to get the id, or to try to manually keep the keys of the workflow with a custom sequence or something, or to update the id after commit.

    You'll need to write your library so that it deals with Java objects which have no knowledge of how they are to be persisted in a database. Once you write code which operates on primary keys, you'll either need to persist the objects in a database already or start using UUIDs. Either way is a step away from the promise of an ORM: to abstract the realities of database storage from the objects your code deals with.

    As far as your URL problem is concerned, you are pretty much sunk if your application has to be sessionless. Which is why any application which begins to have a sophisticated workflow will need to keep objects server-side within a session. Then you have no requirement to create URLs which embed primary keys.

    In short, you are finding it hard to create and manage primary keys in your component mainly because it is the wrong approach for code like this.

    Ari Maniatis

    -- 
    

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



    This archive was generated by hypermail 2.0.0 : Mon Oct 05 2009 - 03:44:49 EDT