Menu

#1 Multi-Column Key Code Gen errors

open
nobody
None
5
2003-11-23
2003-11-23
No

Hello everyone,

I recently downloaded ModelJ to generate an ejb
application from a mySql database schema I created. I
noticed a couple of error conditions consistent in all of
the generated code:

1) A table containing a composite (multi-column) key
does not get a generated correctly. The generator
should have created an ejb primary key class but it did
not (meaning I will have to manually modify the
generated code and deployment descriptors to reference
an ejb primary key class (after I create it of course).

2) By default the code generator references a setId
()/getId() method in the ejb implementation class and
also in to delegates/model classes. The getId()/setId()
methods seems to assume the the primary key column is
named "Id".

I am hoping that ModelJ will become a better alternative
than middleGen but the errors listed above require a
significant amount of rework especially when coupled
with the manaul xml file creation (the xml file that
identifies the SQL table). Regarding the xml file creation
it occurred to me that I could write my own java class
to read the database and use metadata to:
A) get tablename/ column names / datatypes
B) write an xml stanza for table/column

This would make ModelJ competitve with middleGen
provided Modelj can generate primary key classes, and
the primary key column (when its a single column) is
correctly referenced in the code (instead of
referencing "Id" by default).

Discussion


Log in to post a comment.

MongoDB Logo MongoDB