This one time, at band camp, Denis Gautier said:

DG>I've got a "Site" object, representing a site (a place, a monument, ...) and
DG>this site is located in a Region.
DG>What I want to do is 'breaking' the link to a Region, in order to link the
DG>site to another region.
DG>I then get the following exception :
DG>org.exolab.castor.jdo.PersistenceException: Object, <site>, links to another
DG>object, <region> that is not loaded/updated/created in this transaction
DG>Before that (I mean before using the update method), I affected a new region
DG>to my site by using the method setRegion of my site object.

This exception is due to the fact that the Site object was loaded in the
transaction and the related Region object that you're trying to affect
was not loaded. To get around this problem, first load the Site object
and then load the Region object, then break the link to the old Region
object, then commit the changes.

DG>To help you to understand my problem, here's a question about the source
DG>example for castor jdo :
DG>Is it possible to change the Product object which is linked to a
DG>ProductDetail object ????
DG>i.e. :
DG>1) you load a ProductDetail and show the data to the user.
DG>2) the user (by using a list of products in a popup, for example), chooses
DG>another product, in order to link it to the ProductDetail object.
DG>3) you call : myProductDetail.setProduct(newProduct)
DG>4) you call db.update(myProductDetail)
DG>
DG>Is that possible ?

Yes, this is certainly possible. However, db.update() is only used with
Castor's long transactions (http://www.castor.org/long-transact.html). If
you're not using Castor's long transactions, persisting modifications
to objects is handled via db.commit().

BTW, for the benefit of the entire Castor community, please post *all*
questions to the castor-dev mailing list. Information on subscribing
can be found here:

    http://www.castor.org/lists.html

I'm posting this solution there, too.

Bruce
-- 
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

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

Reply via email to