Dear Werner,
It is okay...
I have the src downloaded and I have collated my problem with the myapp
example in the src. I think myapp example is very simple and direct and it
does not explain well on my question. My problem looks more complicated
because of the extra wrapper tags in the XML data, eg:
<developers>
<developer id="1">developer1 </developer>
<developer id="3">developer2 </developer>
<developer id="5">developer3 </developer>
</developers>
OR
<addresses>
<address id="1">address 1</address>
<address id="2">address 1</address>
</addresses>
I think you will understand better on the generated source based on the
schema for xml data above. Based on my message entitled 'My Castor Usage'
description, I think can understand my problem better...
I hope that you can really give me a hand in this matter. I did send Bruce
Snyder the same problem, I think i had sent it in HTML format, and the
message scrambled by the mailing list system. He didnt reply since then.
I am helpless, and I hope that you can really help. I would appreciate it
very much.
Cheers,
Ng Keng Yap
-------Original Message-------
From: [EMAIL PROTECTED]
Date: 13 Oktober 2004 20:34:13
To: [EMAIL PROTECTED]
Subject: Re: [castor-user] How to map this in OR Mapping?
Oops, sorry for the misunderstanding. To be able to persist a hierarchy of
Java objects you'll need to create a mapping file for this purpose. Have a
look
at http://castor.exolab.org/jdo-mapping.html for a syntactical explanation
of the mapping file, and don't hesitate to come back if you have any
questions. Alternatively, if you obtained the sources as well, have a look
at src/tests/jdo/mapping.xml to see some sample mappings.
Werner
On Wed, 13 Oct 2004 20:06:36 +0800, Ng Keng Yap wrote:
>Dear Werner,
>
>Thanks for your fast reply.
>
>I use XML as a data format in data collection and to be loaded to the
>relational database later. I use Castor as the tool to create related java
>objects to enable synchronization between XML dan relational database.
>
>My problem here is not on marshalling and unmarshalling of XML to Object,
>but the problem on Java to Relational Database.
>
>I think I need to map the java objects to the database table using tags
like
><sql>, <map-to> and <many-key>??? Isn't it?
>
>Else, how can make it persistent to the relational database? Any other
>alternative way?
>
>Please refer to the XML schema and the sample data, I think you will
>understand it better my question.
>
>Thank you for your kindness and your answers are appreciated.
>
>
>-------Original Message-------
>
>From: [EMAIL PROTECTED]
>Date: 13 Oktober 2004 19:49:35
>To: [EMAIL PROTECTED]
>Subject: Re: [castor-user] How to map this in OR Mapping?
>
>Hi,
>
>once you've used the SourceGenerator to create Java classes from an XML
>Schema instance, there's no need to use a mapping file anymore (except
>in some exceptional circumstances). Just try to unmarshall from your XML,
>and make sure that generated descriptors et alias are on your CLASSPATH.
>
>Regards
>Werner
>
>On Wed, 13 Oct 2004 19:25:55 +0800, Ng Keng Yap wrote:
>
>>Dear Werner,
>>
>>Thanks for your reply.
>>
>>I have read the source generator manual and I have all the objects
>>successfully generated.
>>
>>My problem is at OR Mapping.
>>
>>I have no idea on how to map the relationship between Project -->
>>Developers(Just a XML wrapper to developer collection) --> developer
>>
>>In which i expect to use the the following tables:
>>
>>Project(id, other_fields)
>>
>>Developer(id, project_id, name, email, other_fields)
>>
>>Cardinalty of Project:Developer is 1:N
>>
>>How can I ignore the Developers collection wrapper???
>>
>>
>>Best regards,
>>Ng Keng Yap
>>
>>-------Original Message-------
>>
>>From: [EMAIL PROTECTED]
>>Date: 13 Oktober 2004 17:44:07
>>To: [EMAIL PROTECTED]
>>Subject: Re: [castor-user] How to map this in OR Mapping?
>>
>>HI,
>>
>>I assume you have read the instructions at http://castor.exolab
>>org/sourcegen.html#Introduction about how to use the SourceGenerator to
>>generate Java classes from your XML Schema, and how to use them during
>>un-/marshalling.
>>
>>Regards
>>Werner
>>
>>PS Please refrain from sending HTML messages to this mailing list (as per
>>the guidelines at
>>http://castor.exolab.org/lists.html#A-note-about-HTML-formatted-e-mail)
>>
>>--Original Message Text---
>>From: Ng Keng Yap
>>Date: Wed, 13 Oct 2004 17:05:17 +0800
>>
>>5C48E2BB-F3D4-470F0B58D-C0A5CFF2D595 3.0 Letter My Collection Default Ng
>>Keng Yap
>>SU1CTDEsNDYsgUmBSY00icEskTAwTTiVKIlNiZ2BOIEwjcEoTTSBJI00ODiRKI3FjUmBSYFJgSx
>
>>JMMiwwLCxJTUJMMywwLCxUeXBlVmVyc2lvbiwzLDEuMCw= no-repeat #ffffff 0px 0px
>>ANIM3D00-NONE-0000-0000-000000000000 0
ANIM3D00-NONE-0000-0000-000000000000
>>1 ANIM3D00-NONE-0000-0000-000000000000 0
>>ANIM3D00-NONE-0000-0000-000000000000 1
ANIM3D00-NONE-0000-0000-000000000000
>>0 X-ASN,X-ASH,X-AN,X-AP,X-AD ; Dear all,
>>
>>I don't know how to map the below XSD in OR mapping?
>>
>>I used Castor Source Generator to generate the Java Objects and The XSD
>>should be kept intact.
>>
>>Help and suggestion are appreciated.
>>
>>Thank you.
>>
>>Best regards,
>>Ng Keng Yap
>>
>>XSD:
>><?xml version="1.0" encoding="UTF-8"?>
>><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault=
>>qualified" attributeFormDefault="unqualified">
>><xs:element name="developer">
>><xs:complexType>
>><xs:sequence>
>><xs:element name="name" type="xs:string" />
>><xs:element name="email" type="xs:string" />
>><xs:element name="contact" type="xs:string" />
>></xs:sequence>
>><xs:attribute name="id" type="xs:integer" use="optional"/>
>></xs:complexType>
>></xs:element>
>><xs:element name="developers">
>><xs:complexType>
>><xs:sequence>
>><xs:element ref="developer" minOccurs="0" maxOccurs="unbounded"/>
>></xs:sequence>
>></xs:complexType>
>></xs:element>
>><xs:element name="project">
>><xs:complexType>
>><xs:sequence>
>><xs:element ref="developers"/>
>></xs:sequence>
>><xs:attribute name="id" type="xs:integer"/>
>></xs:complexType>
>></xs:element>
>></xs:schema>
>>
>>SAMPLE DATA:
>><?xml version="1.0" encoding="UTF-8"?>
>><!--Sample XML file generated by XMLSPY v5 rel. 4 U (http://www.xmlspy
>>com)-->
>><project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>xsi:noNamespaceSchemaLocation="C:\Documents and Settings\Ng Keng
>>Yap\Desktop\developer.xsd" id="0">
>><developers>
>><developer id="0">
>><name>String</name>
>><email>String</email>
>><contact>String</contact>
>></developer>
>><developer id="0">
>><name>String</name>
>><email>String</email>
>><contact>String</contact>
>></developer>
>><developer id="0">
>><name>String</name>
>><email>String</email>
>><contact>String</contact>
>></developer>
>></developers>
>></project>
>>
>>
>>
>>
>>
>>
>
>
>
>-----------------------------------------------------------
>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