Ok, another JDO newbie question...

I don't understand the JDO persistence model. I have a method called 
save(MyClass obj), and I want it check to see if a record with obj.key 
(it's identity) exists in the database. If it does, I want it to update 
that record by replacing it with the new record, otherwise I want it to 
create a new record.

First, when doing an OQL query to discover whether the object is already in 
the database, it seems I have to load the entire record again (which could 
be quite large). Is there any way around that? (I'm currently using "select 
p from blah.MyClass p where key = $1".)

Second, why can't I update(obj)? Or remove(obj)? It has the proper identity 
set, but I can apparently only update and remove objects that have actually 
been loaded from the database. So, right now, I'm writing: 
remove(results.next()); create(obj); ... which seems like a hackish way of 
doing things. What am I missing?

thanks, (and thanks again for all the other help so far)
jeff

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to