Hi Robert,
I was just guessing that since Francisco wanted to be able to display
the "temporary ID" on the user interface that there might be an
expectation (on the user's part?) of being able to write it down/etc
and query for it later. Like a tracking number of some kind. Either
way, I hope his question was answered. :-)
/dev/mrg
On Wed, Mar 11, 2009 at 4:48 PM, Robert Zeigler
<robert.zeigle..mail.com> wrote:
> 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 - 17:04:04 EDT