You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@empire-db.apache.org by Benjamin Venditti <be...@web.de> on 2009/08/17 23:19:15 UTC
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 the code he supplied, 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
Thomas Poling schrieb:
> Greetings All:
>
> Attached is the code generator to create table/record classes based on
> database schema meta-data.
> Please read the Word document in the docs folder first.
> I only have a MySQL database so I haven't tried to make it flexible
> enough to use with other databases. I'm hoping someone with a little
> more DB experience can investigate what it would take to use it with
> other databases.
>
> Please note that in the src folder all the classes under the tfmm
> folder are NOT part of the code generator. They are mostly the code
> that was generated based on my database. I've included the scripts
> for this database under the dbscripts folder. You can also ignore the
> EnumType class for now - I wanted to allow conversion between
> constrained strings in the DB and java enumerated types, but haven't
> gotten to this yet.
>
> Let me know what you think and if we might be able to use this as a
> starting point for something that could be included in a future
> release of EmpireDB.
>
> Thanks, Tom