Greeting All:
Thanks, Benjamin for testing it out. You caught a good error - The BaseRecord.vm template file had a hard-coded package name. The attached files should fix that issue. The only change to the DbCodeGenerator class is to the createBaseRecordClass() method.

As far as the errors associated with get the database meta-data - this could be a larger issue. It seems the definitions of database catalogs vs. schemas depends on the database. There is also a hard-coded reference to the DBDatabaseDriverMySQL class. The Database class should be modified so it can adjust to the database type. Any ideas how this could be done?
Thanks, Tom

----- Original Message ----- From: "Benjamin Venditti" <[email protected]>
To: <[email protected]>
Sent: Monday, August 17, 2009 5:03 PM
Subject: Code Generator [first insights]


Hi there,

first of all, many thanks to Thomas Poling" for supplying his code about the database generator, i'm looking forward to work with it. I really think this could be a very valuable addition to EmpireDB. I compiled code generator you supplied and read the documentation and tried to execute it with a hsql-database some of my fellow students and i designed 2 years ago. Unfortunately i could not get it running out of the box. I had to make the following two adjustments in order to get the classes generated.

CHANGE 1:    dbcodegen.db.Database:73
ResultSet tables = dbMeta.getTables(schemaName, null, "", new String[] {"TABLE"});
changed to:
ResultSet tables = dbMeta.getTables(null, schemaName, null, new String[] {"TABLE"});

CHANGE 2:    dbcodegen.db.Table:161
       ResultSet pkRs = dbMeta.getPrimaryKeys(null, schema, tableName);
changed to:
       ResultSet pkRs = dbMeta.getPrimaryKeys(schema, null, tableName);

The generated classes contain a lot of compilation errors, as the templates contain a few imports/references to classes like "tfmm.persistence.generated.TfmmDatabase". I'm going to play around with the templates soon and let you know more about my results.

Benjamin

Attachment: DbCodeGenerator.java
Description: Binary data

Attachment: BaseRecord.vm
Description: Binary data

Reply via email to