Hi,
I tried to store in the database object generated by SourceGnerator from my XML schema and then to read it back and marshal it.
The XML document is:
<grmsjob>
<simplejob>
<executable>
<!--
<environment>
<variable name="Tomasz">Piontek</variable>
</environment>
-->
</executable>
</simplejob>
</grmsjob>and according to the schema "executable " can contain 0 or 1 element <environment>, which can contain 1-n <variables>
Because <environment> has no attributes, I didn't want to create for it a separated table, so I define 1-n relationship between <executable> and <variable>s and not between <environment> and <variable>s.
<class cst:name="grms.types.jobdesc.Executable" identity="id" key-generator="MAX" depends="grms.types.jobdesc.Grmsjob">
<description>Default mapping for class grms.types.jobdesc.Executable</description>
<map-to cst:xml="executable" table="executables"/>
<field cst:name="id" cst:type="integer" direct="true">
<bind-xml transient="true"/>
<sql name="executable_id" type="integer"/>
</field><field cst:name="environment.variable"
cst:type="grms.types.jobdesc.Variable" cst:required="false" cst:collection="array">
<bind-xml name="variable" node="element"/>
<sql many-key="executable_id"/>
</field>
</class>
When the <environment> contains at least one <variable> everything works file. I'm able to unmarshal object from XML-file then to store it, load back and marshal it.
When there is no <environment> element in XML-document I'm able to unmarshal such description to object then to store it to the database, read it back and marshal it, but the last step (marshalling) is possible only when the object was read in the same VM where it was stored (my client creates an object and several lines farther it is loaded back). In such case (the same VM) the "environment" member in "executable" object is NULL (probably the object was loaded from cache).
When I invoke my clients this way that it omits creation of object and tries to load object stored during the previous run (I do a query for object with know id ), object is successfully loaded but the difference is that environment member is NOT NULL and it has O <variables>. In this case I'm not able to marshal it because the constraint defines that it has to be at least one <variable>.
1) Could anyone tell me why there are such differences? In my opinion it is somehow connected with cache.
2) Is there any possibility to prevent castor to create Grmsjob.simplejob.executable.environment member ( should be NULL) when there is no <environment> in XML document? In my opinion it is bug, but I'm not sure, so I'm waiting for any comment before I submit it to bugzilla.
I attached schema and mapping files. The whole testing environment can be downloaded from
I don't know if I explained everything enough clearly, if not please send me a mail for more details.
All the best, Tomek
<?xml version="1.0" encoding="UTF-8"?> <mapping xmlns="http://castor.exolab.org/" xmlns:cst="http://castor.exolab.org/"> <description>Castor generated mapping file</description> <class cst:name="grms.types.jobdesc.Grmsjob" identity="id" key-generator="MAX"> <description>Default mapping for class grms.types.jobdesc.Grmsjob</description> <map-to cst:xml="grmsjob" table="grmsjobs"/> <field cst:name="id" cst:type="integer" direct="true"> <bind-xml transient="true"/> <sql name="grmsjob_id" type="integer"/> </field> <field cst:name="jobId" cst:type="java.lang.String" cst:required="true"> <bind-xml name="jobId" node="attribute"/> <sql name="jobid"/> </field> <field cst:name="simplejob.executable" cst:type="grms.types.jobdesc.Executable" cst:required="true"> <bind-xml name="executable" node="element"/> <sql name="executable_id"/> </field> </class> <class cst:name="grms.types.jobdesc.Executable" identity="id" key-generator="MAX" depends="grms.types.jobdesc.Grmsjob"> <description>Default mapping for class grms.types.jobdesc.Executable</description> <map-to cst:xml="executable" table="executables"/> <field cst:name="id" cst:type="integer" direct="true"> <bind-xml transient="true"/> <sql name="executable_id" type="integer"/> </field> <field cst:name="environment.variable" cst:type="grms.types.jobdesc.Variable" cst:required="false" cst:collection="array"> <bind-xml name="variable" node="element"/> <sql many-key="executable_id"/> </field> </class>
<class cst:name="grms.types.jobdesc.Variable" identity="id" key-generator="MAX" depends="grms.types.jobdesc.Executable">
<description>Default mapping for class grms.types.jobdesc.Variable</description>
<map-to cst:xml="variable" table="variables"/>
<field cst:name="id" cst:type="integer" direct="true">
<bind-xml transient="true"/>
<sql name="variable_id" type="integer"/>
</field>
<field cst:name="name" cst:type="java.lang.String" cst:required="true">
<bind-xml name="name" node="attribute"/>
<sql name="variable"/>
</field>
<field cst:name="content" cst:type="java.lang.String">
<bind-xml name="PCDATA" node="text"/>
<sql name="value"/>
</field>
<field name="executable" type="grms.types.jobdesc.Executable">
<sql name="executable_id"/>
</field>
</class>
</mapping>
<?xml version="1.0" encoding="UTF-8"?> <!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com) by Tomasz Piontek (Instytut Chemii Bioorganicznej PAN) --> <!-- recznie dodana enumeracja do typu zadania -> poprawka z xmlspya--> <!-- modyfikacja: usuniecie restriction na minLen--> <!-- usuniecie command--> <!-- zmiana w resources na integer--> <!-- zmiana: localrmname jest enumeracja (fork, lsf..)--> <!-- zmiana typu argumentu typu value - typ zlozony --> <!-- wydziedziczenie fileType z baseFile --> <!-- zmiana collection na collectionfile --> <!-- dodanie parametrow siecowych--> <!-- dodanie zaleznoscie czasowych--> <!-- dodanie wymagan na aplikacje--> <!-- dodanie dodatkowych parametrow w req--> <!-- dodanie persistency dla Triany--> <!-- dodanie w exec atrybutu checkpointable--> <!-- dodanie queue do resource --> <!-- dodanie nazwy aplikacji zamiast pliku z exec --> <!-- rozszerzenie opisu executionTime --> <!-- zmiana resource na unbounded --> <!-- zmiana w execTime: execTime --> <!-- zmiana w checpoint file--> <!-- dowolna kolejnosc w arg --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="grmsjob"> <xs:annotation> <xs:documentation>Job Description for Gridlab Resource Management System</xs:documentation> </xs:annotation> <xs:complexType> <xs:choice> <xs:element name="simplejob" type="simplejobType"> <xs:annotation> <xs:documentation>Description of Simple Job</xs:documentation> </xs:annotation> </xs:element> </xs:choice> </xs:complexType> </xs:element> <xs:complexType name="simplejobType"> <xs:annotation> <xs:documentation>Description of Simple Job</xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="executable"> <xs:annotation> <xs:documentation>Application description section</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="environment" minOccurs="0"> <xs:annotation> <xs:documentation>Environment variables</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="variable" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="name" type="xs:string" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:schema>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
