cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Zeigler <>
Subject Re: Coming from EOF: Cayenne vs Hibernate
Date Wed, 11 Mar 2009 20:48:36 GMT
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.


View raw message