You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Chris Greenlee <CG...@demandsolutions.com> on 2003/03/18 05:03:31 UTC
Indexes
Hi all,
The index attribute for a field descriptor in OJB isn't adequate for a
table that needs multiple indexes with multiple fields in each. It also
doesn't allow the defining of unique constraints. I would like to propose
a change to the definitions of indexes as follows:
1. Modify the repository DTD to make <index-descriptor/> a child of
<class-descriptor/>:
<!ELEMENT class-descriptor
((documentation?, extent-class+, attribute*) |
(documentation?, extent-class*, field-descriptor+,
reference-descriptor*, collection-descriptor*,
index-descriptor*, attribute*))>
<!ELEMENT index column-name+>
<!ATTLIST index-descriptor
unique (true | false) "false">
2. Modify the RepositoryXmlHandler and RepositoryTags to handle
index-descriptors. The IndexDescriptor class is already in cvs,
ClassDescriptor already has a Vector of them, and the TorqueTableGenerator
uses a TorqueIndexGenerator to add the indexes to a Torque schema. That
allows us to use Torque to generate the SQL that will create the tables
and the indexes on them.
3. Modify the IndexDescriptor to implement toXML(), and alter the toXML()
of ClassDescriptor to call toXML() on each member of its Vector of
IndexDescriptors.
I can have this done in a few hours; it's something my company needs. In
addition, I'll be submitting patches to Torque soon that smooth the way
for using a Torque schema generated by OJB to generate the SQL for
databases. We're using those changes currently to handle database
creation for Microsoft SQL Server, Oracle, and PostgreSQL. And we'd
really like to get all this submitted ASAP, because we're so very tired of
maintaining local versions of Torque and OJB.
Regards,
Chris Greenlee