I am little confused about the behavior and functionality of the transient attribute.
 
Question 1.
I am pretty sure that transient="true" means don't store. Does it also mean don't load?  I think in Castor's case it means don't store. I don't think Castor supports the case where you may need a field for XML and not for the database.
 
Question 2:
Are the following mapping functionally equivalent?
 
// with sql field
<field name="fieldA" type="ClassA" transient="false">
<bind-xml name="fieldA" transient="false" />
<sql transient="true" />
</field>
 
// without sql field
<field name="fieldA" type="ClassA" transient="false">
<bind-xml name="fieldA" transient="false" />
</field>
 
Question 3:
Does the ClassMolder class impact XML marshalling and unmarshalling.
 
Question 4:
I looked at the documentation and you can specifiy transient at the field level, xml level and the sql level.
Why doesn't the org.exolab.castor.mapping.xml.Sql class have a transient field? The ClassMolder class seems todo blind databinding for all the fields in the class. In doesn't check to see if the field mapping has a sql attribute.
 
 
Steve
 
 
 
----- Original Message -----
Sent: Friday, February 07, 2003 3:07 PM
Subject: Re: [castor-dev] sql transient attribute ignored

Transient fields mapping aren't working? I delved a little deeper and I think it is bug 942, Transient fields fail to load in mapping. I downloaded the latest cvs build and I think it got broke again.   I still get a IllegalArgumentException for the following mapping.
 
<field name="webResources" type="com.opendemand.jdo.WebResource"
collection="arraylist" required="false"
get-method="getWebResources" set-method="setWebResources" transient="true">
<bind-xml name="web-resource" node="element" transient="false" auto-naming="deriveByClass"/>
<sql transient="true" />
</field>
-----------------------------------------------
<class name="com.opendemand.jdo.UserScenario" auto-complete="false" identity="userScenarioId" key-generator="MAX">
:
<field name="webResources" type="com.opendemand.jdo.WebResource"
collection="arraylist" required="false"
get-method="getWebResources" set-method="setWebResources" transient="true">
<bind-xml name="web-resource" node="element" transient="false" auto-naming="deriveByClass"/>
<sql transient="true" />
</field>
:
</class>
-----------------------------------------------
 
In source src/main/org/exolab/castor/jdo/engine/SQLEngine.java line 315 to 322
----------------------------------------------
if ((fieldDescriptors[i] instanceof JDOFieldDescriptor) ||
(fieldDescriptors[i].getClassDescriptor() != null)) {
if ( stack.empty() ) {
fieldsInfo.add( new FieldInfo( clsDesc, fieldDescriptors[i], clsDesc.getTableName(), !extendField ) );
} else {
fieldsInfo.add( new FieldInfo( clsDesc, fieldDescriptors[i], base.getTableName(), extendField ) );
}
}
----------------------------------------------
 
I think the problem is that I have a class description for WebResource but I would still the webResources to be transient for UserScenario.
 
 
Steve
----- Original Message -----
Sent: Thursday, February 06, 2003 4:13 PM
Subject: [castor-dev] sql transient attribute ignored

I am having problems with Castor ignoring the sql transient tag.  I am using castor 9.4.2 on Windows XP with Mysql. Does anyone know how to prevent Castor from loading database transient classes? It keeps loading the WebResources classes from the database. It works when I comment out the mapping entry.  I need the mapping entry for XML marshalling and unmarshalling.
 
Here is a copy of my mapping.xml.
:
<field name="webResources" type="com.opendemand.jdo.WebResource"
collection="arraylist" required="false"
get-method="getWebResources" set-method="setWebResources" >
<sql transient="true" />
<bind-xml name="web-resource" node="element" transient="false"/>
</field>
 
 
:
 
 
Steve

Reply via email to