Canonical objects

From: Gili (cowwo..bs.darktech.org)
Date: Sat Sep 03 2005 - 01:01:40 EDT

  • Next message: Gili: "DataContext.invalidateObject(DataObject)"

    Hi,

            Say I have:

    table ImageSpecification [id, width, height]

            In Hibernate if I created a new ImageSpecification in my application
    and I wanted to save it into the database only if it didn't already
    exist (i.e. canonicalization) I would have to manually invoke something
    like this:

    mySpecification = mySpecification.getCanonicalInstance()

            where getCanonicalInstance() is a method I implemented to issue a DB
    query and if an equivilent object was found in the DB return it;
    otherwise return "this". In this way I would ensure that I never ended
    up with two copies in the database of the same specification.

            Would I have to do the same with Cayenne or is there a cleaner way?

    Thank you,
    Gili

    -- 
    http://www.desktopbeautifier.com/
    



    This archive was generated by hypermail 2.0.0 : Sat Sep 03 2005 - 01:01:40 EDT