SDO Types specified in XML Schema Definition (*.xsd) files can be converted to Java classes annotated for persistence.
$ java org.apache.openjpa.sdo.SDO2POJOGenerator person.xsd
will convert one or more SDO types specified in person.xsd, annotate them for persitence and save them in corresponding *.java file. The generated Java source files are written relative to the current directory.
Specify -rootDirectory or simply -d option to write to another location in the disk. For example,
$ java org.apache.openjpa.sdo.SDO2POJOGenerator -d generated/src/ p.xsd q.xsd
will convert SDO Types from both p.xsd and q.xsd to Java source code and write them to a directory relative to generated/src/.
The SDO Type are mapped isomorphically to Java classes (with one exception).
No Java source code is generated for Container type.
The property of Container type is mapped as java.util.List whose element is Java equivalent of component type.
The generated Java source code is annotated with JPA annotations.
Java package name for SDO Types can be specified in sdoJava:package in *.xsd header. For example,
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:example="http://www.example.com/Example"
targetNamespace="http://www.example.com/Example"
xmlns:sdo="commonj.sdo"
xmlns:sdoJava="commonj.sdo/java"
sdoJava:package="example.domain">
<xsd:complexType name="Person">
....
will generate a Java class with fully-qualified name example.domain.Person.