When trying for tool to convert from DB Schema to SDO Model xsds - tried
using
SDO's XSDHelper in one attempt and Apache Torque in another.
1) When using XSDHelper -------------------
Tried using XSDHelper.generate() to take as input param the SDO created by
DAS
using its dynamic DO creation approach. Saw that when there is a SDO which
contains child DO (like Table STATES will contain table CITIES), it was
giving below exception originating from EMF -
java.lang.IllegalArgumentException: The 'no duplicates' constraint is
violated
java.lang.IllegalArgumentException: The 'no duplicates' constraint is
violated
at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:642)
at org.eclipse.xsd.impl.XSDNamedComponentImpl.addToSortedList(
XSDNamedComponentImpl.java:165)
at org.eclipse.xsd.impl.XSDSchemaImpl$3.caseXSDTypeDefinition(
XSDSchemaImpl.java:1801)
at org.eclipse.xsd.util.XSDSwitch.doSwitch(XSDSwitch.java:201)
at org.eclipse.xsd.util.XSDSwitch.doSwitch(XSDSwitch.java:88)
at org.eclipse.xsd.util.XSDSwitch.doSwitch(XSDSwitch.java:74)
at org.eclipse.xsd.impl.XSDSchemaImpl.adoptContent(XSDSchemaImpl.java
:1819)
at org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(
XSDConcreteComponentImpl.java:1160)
at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(
EcoreEList.java:234)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(
NotifyingListImpl.java:292)
at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:600)
at org.apache.tuscany.sdo.helper.SchemaBuilder.buildComplexSchemaType(
SchemaBuilder.java:352)
at org.apache.tuscany.sdo.helper.SchemaBuilder.buildSchema(
SchemaBuilder.java:551)
at org.apache.tuscany.sdo.helper.SchemaBuilder.addElement2ComplexType(
SchemaBuilder.java:188)
at
org.apache.tuscany.sdo.helper.SchemaBuilder.buildComplexSchemaTypeContents(
SchemaBuilder.java:306)
at org.apache.tuscany.sdo.helper.SchemaBuilder.buildComplexSchemaType(
SchemaBuilder.java:371)
at org.apache.tuscany.sdo.helper.SchemaBuilder.buildSchema(
SchemaBuilder.java:551)
at org.apache.tuscany.sdo.helper.XSDHelperImpl.generate(
XSDHelperImpl.java:287)
at org.apache.tuscany.sdo.helper.XSDHelperImpl.generate(
XSDHelperImpl.java:268)
2) When using Apache Torque--------------------
Apache Torque generator task - jdbc worked well and the output (say
schema.xml)
could be used by stax to form the SDO Model xsds. This approach turned out
to be
simpler and no dependency on SDO and EMF.
I am creating tuscany-das-tools to place this utility tool and also creating
maven plugin for same.
Suggestions?
Regards,
Amita
On Nov 26, 2007 6:29 PM, Amita Vadhavkar <[EMAIL PROTECTED]> wrote:
> http://www.mail-archive.com/[email protected]/msg25916.html
>
> As first attempt trying to create an utility/tool to convert from DB
> Schema to model XSDs -
> RDB DAS has a reusable core part which uses DB Metadata to create SDO
> Types and properties. Its result can
> be fed to Tuscany SDO's XSDHelper to form XSDs.
>
> http://www.mail-archive.com/[email protected]/msg19374.html
> DB SChema->SDO->XSD is possible without errors as it comes from Types
> generated from SDO
>
> Use:
> When doing static SDO model based Data Access (not only RDB DAS) and
> model is not available or not up-to-date w.r.t. DB schema -
> like cases of rapid prototyping when DB schema is undergoing changes.
>
> Limitation:
> DB Metadata APIs should support -
> DatabaseMetaData.getTables(), getPrimaryKeys(), getCrossReference(),
> ResultSetMetaData.getColumnCount(), getTableName(), getSchemaName(),
> getColumnName(), getColumnType(),
>
> Suggestions?
>
> Regards,
> Amita
>