Re: Coming from EOF: Cayenne vs Hibernate

From: Robert Zeigler (robert.zeigle..mail.com)
Date: Wed Mar 11 2009 - 16:48:36 EDT

  • Next message: Michael Gentry: "Re: Coming from EOF: Cayenne vs Hibernate"

    Interesting to see the comments coming from a hibernate + cayenne user
    (me) vs. an EOF + cayenne user (Mike). :)
    Just wanted to follow up on the question and comment below:

    >
    > Cayenne doesn't really have this, either. (Neither does EOF.) You
    > have to commit to have the PKs assigned (unless you assign them
    > yourself). There might be a temporary ID, but it sounds like you are
    > asking about something more permanent that can be looked up later.
    >
    >
    >> Those are my main disagreements with the way I have to work with
    >> JPA/Hibernate... will switching to
    >> Cayenne help me with those? And if it works... here is a crazy
    >> idea... what
    >> if you guys developed a wrapper that could work on top of any JPA
    >> provider
    >> to offer a higher level EOF like API ?
    >>
    >> Regards,
    >> Francisco

    It's true that there is no /long term/ temporary pk; you have to
    commit for the db for that.
    But the following also holds:

    MyPersistentObj obj = context.newObject(MyPersistentObj.class);
    assert obj.getObjectId() != null

    MyPersistentObj obj2 = context.newObject(MyPersistentObj.class);
    assert !obj.getObjectId().equals(obj2.getObjectId());

    which is the critical piece of information that, I think, Francisco
    was looking for.
    In the hibernate world, your object is "new" if the object's id is null.
    Otherwise, it's persisted in the database w/ a pk. There is no "in
    between" state.

    Robert



    This archive was generated by hypermail 2.0.0 : Wed Mar 11 2009 - 16:49:17 EDT