Werner,

> 
> Emir,
> 
> On Fri, 25 Feb 2005 13:48:27 +0100, [EMAIL PROTECTED] wrote:
> 
> >
> >> 
> >> Emir,
> >> 
> >> On Fri, 25 Feb 2005 11:06:17 +0100, [EMAIL PROTECTED] wrote:
> >> 
> >> >
> >> >Werner,
> >> >I have two different mappings.
> >> >It's the problem with XML transient field and not JDO. The JDO 
> >> part seems to work fine.
> >> >I would like to here from Keith.
> >> I tend to disagree.  FOr your code to work, the marshaller 
> (during 
> >> marshalling) will call a getter method on your lazy-loaded 
> object. 
> >
> >But, the lazy-loaded object is marked transient in the XML 
> mapping?! Why is it accessing it?
> 
> What does the field mapping for this field actually look like ? 

It looks nice. :-))) Just kidding. :-))

Please, let me explain.
As I've said before there are 2 mapping files.
One is loaded by a component that handles the access to db using castor. 
Another component, let's say 'presentation tier' :), uses this db handler to 
load objects. When the presentation tier receives the object the transaction is 
commited and the presentation layer is not interested in this lazy loaded filed 
(marked lazy-loaded at the JDO-mapping.xml) and thus it is marked transient in 
the XML-Mapping.xml.
But, when I try to marshal this object - the before mentioned exception raises.






> 
> >
> >> And that's where teh 
> >> problem seems to be: if you are not within the original 
> >> transaction anymore, SingleProxy (the class managing lazy-
> loading 
> >> objects) will complain that it 
> >> does not have access to a valid transaction anymore.
> >> 
> >> Is there a chance you could invoke Marshaller.marshall() before 
> >> committing/rolling back your transaction ?
> >> 
> >Currently, it's not an option. Class is marshalled in the part of 
> app that doesn't manage the JDO transactions and gets objects by 
> another part of app 
> that's actually working with JDO.
> >Anyway, this is not so important, because I've fixed my app to 
> work as I desire, but I was just wondering why... :-)
> 
> We still need to get our head around on allowing lazy laoding for 
> 'long' transactions, i.e. outside the scope of the transaction 
> where this has been 
> loaded. Have a look at existing bugs .. as I am sure there's one 
> or two talking about these things.

In this scenario I don't need lazy loading in long transactions. For this part 
of app I don't need these fields to be loaded, actually I don't want them to be 
accessed at all by XML marshaller.

Emir


> 
> Werner
> 
> >
> >
> >
> >> Werner
> >> 
> >> 
> >> >Here's a pseudo code and explanation:
> >> >1. products have items field. in JDO Mapping items are marked 
> as 
> >> lazy-loaded for products.
> >> >In the XML mapping file, I have this items field of products 
> >> marked as transient.
> >> >when i try to do this:
> >> >
> >> >product = db.load(...);
> >> >marshaller.marshall(product);
> >> >
> >> >I got exception that trans is not in progress - this is 
> because 
> >> lazy-loading implementation (this Relational collection or 
> >> whatever) doesn't allow us to 
> >> iterate lazy-loaded fields out of transaction.
> >> >
> >> >Now, if I do this:
> >> >
> >> >product = db.load(...);
> >> >product.setItems(null); 
> >> >marshaller.marshall(product);
> >> >
> >> >everything works fine.
> >> >
> >> >Later I can write a unit-test and submit a report to buzilla. 
> I'm 
> >> almost sure that this is a bug on XML side, just want to here 
> from 
> >> Keith.>
> >> >Regards,
> >> >Emir
> >> >
> >> >
> >> >
> >> >
> >> >----- Original Message -----
> >> >From: Werner Guttmann <[EMAIL PROTECTED]>
> >> >Date: Friday, February 25, 2005 11:05 am
> >> >Subject: Re: [castor-user] [XML] Why Castor iterates transient 
> >> collection field?
> >> >
> >> >> 
> >> >> Emir,
> >> >> 
> >> >> can you please provide us with a short code sample that 
> shows 
> >> us 
> >> >> what you are trying to do. 
> >> >> 
> >> >> In general, Castor JDO does not have support for transient 
> >> >> attributes as it stands right now. There's a bug (1210) out 
> >> there 
> >> >> that will (once finished) address 
> >> >> this problem, but I have not been able to finish this in 
> time 
> >> for 
> >> >> the 0.9.6 release.
> >> >> 
> >> >> Regards
> >> >> Werner
> >> >> 
> >> >> On Fri, 25 Feb 2005 10:00:56 +0100, [EMAIL PROTECTED] wrote:
> >> >> 
> >> >> >
> >> >> >Keith,
> >> >> >I have a class which is a JDO and it has a collection 
> field. I 
> >> >> load this class' objects from database using Castor JDO and 
> >> then 
> >> >> try to marshall it using 
> >> >> Castor XML. One of the fields in my class is a collection 
> field 
> >> >> which is lazy loaded. When I marshall the class I don't need 
> >> this 
> >> >> field be marshalled, so I've 
> >> >> set it in XML mapping as transient. But, when I try to 
> marshall 
> >> >> it, the Castor raises a Transaction not in progress! 
> exception. 
> >> >> This is related to JDO's lazy 
> >> >> loading. When I setLazyLoadedCollection(null) prior to 
> >> marshalling 
> >> >> I got no expcetion.
> >> >> >
> >> >> >Why Castor tries to iterate this transient collection?
> >> >> >
> >> >> >Regards,
> >> >> >Emir
> >> >> >
> >> >> >
> >> >> >
> >
> >
> >
> >----------------------------------------------------------- 
> >If you wish to unsubscribe from this mailing, send mail to
> >[EMAIL PROTECTED] with a subject of:
> >        unsubscribe castor-user
> >
> 
> 
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>        unsubscribe castor-user
> 
> 



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

Reply via email to