Hi Ken, > I would like to use OJB without using a repository.xml file > to define the object-relational mappings. Instead, I'd like > my application to define the necessary mappings by making API > calls during initialization. That is, I expect my > application to initialize by first making some calls to > define mappings, and then creating a persistence broker that > uses those mappings -- but without any intermedate XML files created. > > The high-level documentation on the Jakarta website suggests > that this should be possible (to quote from tutorial1: "The > repository consists of ordinary Java objects that can be > created and modified at runtime."). But I can't seem to > figure out how to do it. In particular, it seems that to > create a broker, I need a PBKey, and that in turn always > refers to an XML file. >
It should still be possible. You can define a minimal repository.xml (it must contain a jdbc-connection-descriptor and at least one class-descriptor. <!ELEMENT descriptor-repository (jdbc-connection-descriptor, class-descriptor+)> The class-descriptor could be a dummy entry. On launching your application you can then build up ClassDescriptor objects that contain the mapping information. These ClassDescriptors cant be placed into the repository by calling http://jakarta.apache.org/ojb/apidocs/org/apache/ojb/broker/PersistenceBroke r.html#setClassDescriptor(org.apache.ojb.broker.metadata.ClassDescriptor) cheers, Thomas > Can somebody please outline how to go about defining mappings > entirely through the API? > > Thanks very much for your help. > > Ken > > --- > Kenneth R. Traub, Ph.D. > Chief Technical Officer > ConnecTerra, Inc. > 100 CambridgePark Drive, 1st Floor > Cambridge MA 02140 > Voice: 617 441-2212 > FAX: 617 492-5837 > Email: [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
