Id problem when trying to make a component decoupling a module

From: han..elinux.cl
Date: Mon Oct 05 2009 - 00:31:43 EDT

  • Next message: Mark Fraser: "Prefetching and iterated queries"

    Hi,

    I've crashed again with the infamous message Can't get primary key from temporary id.

    This has happened me constantly in the area of reusing code.

    Some weeks ago, i needed to create an objet and then send its id in the url to a web control responsible to filling it. I was forced to commit between the transaction to obtain the id. The process was simple and we were able to live with it.

    Now we are forcing something more complex: our company developped a very complex software and in the process we developed a very robust workflow engine to support it.
    We decided to decouple the workflow component from the application where it was born. The idea is to make a jar file for using in other projects, and not resort to copy paste.

    As you can see, the extraction means decoupling the workflow and associated classes from the rest of the classes of the system.

    In order for workflow classes not to depend on any particular class, it was necessary to remove the relationships in cayenne and try to make a soft bind with cayenne using the id of the related workflow in the classes that wich to use it.

    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.

    Note: Sharing of the map was very easy and worked fine.

    Any help will be appreciated.

    Thanks
    Hans



    This archive was generated by hypermail 2.0.0 : Mon Oct 05 2009 - 00:22:44 EDT