On db.open() when you parse the XML document to verify it's structure and relationship mapping to the beans, do a check to see if the table exists. If it doesn't exist build it. Once it's built keep the information in a cached file somewhere and allow us to turn the cache check on or off, this way if we have it off (for development environment) it will always check on db connect and create what ever it needs to create. If it's on, for deployment, it will check once, cache the info, and then never worry about it again unless the cache file is deleted. After that the rest is gravy.
It's a great feature especially for new application deployment. I love to be able to have a war file with everything in it, upload the war file, it unpacks, connects to the DB, builds the tables and the app is installed. For all the time we spend deploying an application, setting up the database is perhaps the most arduous task these days. This solves the problem.
Thanks
On Tuesday, Feb 25, 2003, at 02:21 US/Eastern, Thomas Mahler wrote:
Hi Jeffrey,R
Here's at least a piece of a bone: in src/test/org/apache/ojb/OJB.properties set the switch autobuild=true.
OJB will then check if the table defined in the ClassDescriptor does already exist on each access to the table.
If it does not yet exist the table is generated by create table statement. This statement is constructed by the mapping info contained in the class-descriptor.
This is an undocumented feature! And it is undocumented because we have not decided yet if it is meant to stay. (It's a performance killer).
cheers, Thomas
Jeffrey Gilbert wrote:Anyone know of any additional instructions on how to dynamically create a persistent object/table?
The only thing I have to go on so far is what is in the FAQ:
DescriptorRepository dr = MetadataManager.getInstance().getRepository();
ClassDescriptor cld = new ClassDescriptor(dr);
cld.setClassOfObject(A.class);
//.... other setter
// add the fields of the class
FieldDescriptor fd = new FieldDescriptor(cld, 1);
fd.setPersistentField(A.class, "someAField");
cld.addFieldDescriptor(fd);
// now we add the the class descriptor
dr.setClassDescriptor(cld);
This code above when modified for my application doesn't result in a new table with my hypersonic datastore. Could someone toss me a bone? ;-)
Jeff
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Robert S. Sfeir Senior Java Engineer Codepuccino, Inc. [EMAIL PROTECTED]
definition - Codepuccino n:
A Little JSP mixed with lots of Java, usually served with Servlets, a Datasource, a sprinkle of XML, and sometimes EJB. (See Great MVC Frameworks)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
