empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "McKinley (JIRA)" <empire-db-...@incubator.apache.org>
Subject [jira] Issue Comment Edited: (EMPIREDB-69) Codegen Many Table Patterns, Template Folder in Config, and many more
Date Fri, 08 Jan 2010 16:51:13 GMT

    [ https://issues.apache.org/jira/browse/EMPIREDB-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798049#action_12798049
] 

McKinley edited comment on EMPIREDB-69 at 1/8/10 4:51 PM:
----------------------------------------------------------

I have found it necessary for my needs to use custom velocity
templates (I do not need a "C_" prefix on my column names for
example). In some cases, I need different templates for SQL Server and
MySQL. Therefore, being able to specify a template folder in the
config file is convenient. I have added that.

There is a bug in codegen where a column named "state" will conflict
with DBRecord.getState() or was it DBRecord.setState()? I added a
feature to compare each generated accessor and mutator name against
the method names of DBRecord. If there is a conflict, "Column" is
appended to the getter name and setter name to keep them consistent. I
would like someone to answer the question quoted at the bottom of this
email to let me know if the column name in the table class will need
to be named consistent to the getter and setter too.

In one of my databases, my table names are already camel case so I
added a check for that in the javaClassName method. If '_' and ' ' are
not present (some schemas can have ' ' in the name) then it will not
try and uppercase beyond the first character.

There is a little hack for MySQL default value on timestamp data type.
It may be a hack or it may be the right way to do it, but I think it
should go into codegen now and get pushed upstream later or kept in
codegen but surrounded by checks from supported features in the
Empire-db database drivers.

The best feature I have added here is support for AUTOINC in codegen.
My schemas use AUTOINC but this introduces and interesting problem for
codegen. Codegen will not create the right Java data type in the
Record class for the AUTOINC column if we change the type.  So, I use
an attribute to store the base data type (usually int, but could be
others) and made changes to read that data type during the creation of
the Record class.

      was (Author: mckinley1411):
    This also includes a bug fix for DBRecord method name conflicts.
  
> Codegen Many Table Patterns, Template Folder in Config, and many more
> ---------------------------------------------------------------------
>
>                 Key: EMPIREDB-69
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-69
>             Project: Empire-DB
>          Issue Type: New Feature
>          Components: CodeGenerator
>    Affects Versions: empire-db-2.0.7-incubating 
>            Reporter: McKinley
>             Fix For: empire-db-2.0.7-incubating 
>
>         Attachments: empire-db-codegen.patch
>
>
> I have various improvements to the codegen to give as a patch. I will attach the files
here if possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message