Hi all,
I want to use Costor to marshal objects to XML stream in a J2EE environment.
I have to marshal an ArrayList of MyObject entity objects. These objects aren't Entity Beans, but plain Java objects mapped to a database using Hibernate.
I created a simple mapping file :
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.exolab.org/mapping.dtd">
<mapping>
<description>Country List mapping</description>
<class name="java.util.ArrayList"
auto-complete="true">
<map-to xml="myobjects" />
</class>
</mapping>All works fine. I get :
<?xml version="1.0" encoding="UTF-8"?>
<myobjects>
<my-object num="1">
<attr1>Value 1-1</attr1>
<attr2>Value 1-2</attr2>
<attr3>Value 1-3</attr3>
</my-object>
<my-object num="2">
<attr1>Value 2-1</attr1>
<attr2>Value 2-2</attr2>
<attr3>Value 2-3</attr3>
</my-object>
</myobjects>Now I wanted to change the mapping to remove some attributes from the resulting XML file. I modified the mapping file like this :
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.exolab.org/mapping.dtd">
<mapping>
<description>Country List mapping</description>
<class name="java.util.ArrayList"
auto-complete="true">
<map-to xml="myobjects" />
</class>
<class name="com.myorg.myproject.entities.MyObject"
auto-complete="true">
<map-to xml="myobject" />
<field name="attr1" transient="true"/>
<field name="attr3" transient="true"/>
</class>
</mapping>When I try to marshal using this mapping, I get the error message :
org.exolab.castor.mapping.MappingException: Could not find the class com.myorg.myproject.entities.MyObject
at org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoader.java:340)
...
I'm sure of the package path. Are there restrictions on the Castor use in a J2EE environment ?
Any suggestion ?
Regards
-- A. ROY
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
