I am using Castor 9.4. I can't seem to get
the transient="false" for JDO to work.
In my example a "UserScenario" can
contain "WebResources" and a "WebResource" and contain a
"WebResources" Basically I am trying to get castor to use the
"allWebResources" for database persistence and use "webResources" field for
xml persistence.
When I don't include the "webResources"
field the database persistence piece works fine.
When I do include the "webResources" field tag the
database persistence engine will call the "getWebResources" method.
Why? If you include the field tag, castor makes an implicit store to the
database.
Here is a copy of my Map file.
<class
name="com.opendemand.jdo.UserScenario" auto-complete="false"
identity="userScenarioId"
key-generator="MAX">
<description>Default mapping for class com.opendemand.jdo.UserScenario</description> <map-to xml="user-scenario" table="user_scenario"/> <cache-type type="none" /> <field name="userScenarioId" type="integer" required="false" direct="false" transient="false"> <sql name="user_scenario_id" type="integer"/> <bind-xml name="user-scenario-id" transient="true"/> </field> <field name="allWebResources" type="com.opendemand.jdo.WebResource" collection="map" requried="false" transient="false" get-method="getAllWebResources" set-method="setAllWebResources" > <sql many-key="user_scenario_id" dirty="ignore"/> <bind-xml transient="true"/> </field> <field name="webResources" type="com.opendemand.jdo.WebResource" collection="collection" requried="false" get-method="getWebResources" set-method="setWebResources" transient="true"> <bind-xml name="web-resource" node="element" transient="false"/> </field> </class> <class name="com.opendemand.jdo.WebResource" identity="webResourceId" key-generator="MAX" depends="com.opendemand.jdo.UserScenario"> <description>Default mapping for class com.opendemand.jdo.WebResource</description> <map-to table="web_resource" xml="web-resource"/> <cache-type type="none" /> <field name="webResourceId" type="integer" required="false" direct="false" transient="false"> <sql name="web_resource_id" type="integer" dirty="ignore" /> <bind-xml name="web-resource-id" transient="true" /> </field> <field name="webResources" type="com.opendemand.jdo.WebResource" required="false" direct="false" collection="collection" get-method="getWebResources" set-method="setWebResources" transient="true" > <bind-xml name="web-resource" node="element" auto-naming="deriveByClass" transient="false"/> </field> </class>
|
- Re: [castor-dev] sql transient problem Stephen Ince
- Re: [castor-dev] sql transient problem Mickaël Guessant