Discussion:
[Middlegen-user] middlegen, jboss, and cmp and cmr fields with the same name
Scott Walters
2002-11-25 18:34:39 UTC
Permalink
Hi,

Looking back over the list archive, I can see that this has caused a lot
of frustration. A lot of messages complain about duplicate column names
in the sql statements or NULL values for foreign key inserts. JBoss is
very stringent about this. It looks like it wants to completely manage
the relationship tables for you even to the point where you don't ever
have to specify or create them. I haven't read the CMP 2.0 spec (I know
I really need to) but this seems unrealistic if you have to deal with a
large legacy database that has to work for existing, non-j2ee client
applications. These databases already have relationship tables defined
and they usually carry along several extra fields in addition to the
relation foreign keys. Many times, they also have a composite primary
key that contains the relation key. This will blow up completely since
JBoss will try to insert a NULL value for this field.

Since I really like middlegen and it seems to be really good at
generating beans and xdoclet tags that conform to the database
structure, I decided that if I wanted to use JBoss, I would have to make
some changes to it. The changes I made enable it to work smoothly with
unaltered middlegen generated code. I've tested table creates, inserts,
updates and deletes with both single & composite foreign and primary
keys using both postgres and MSSQL 2000. If you want to check out the
modifications, you can download them from
http://personalweb.edge.net/~walters/jboss3-cmpcmr.tgz

Since I may be using these changes in the migration of a large legacy
application to j2ee. I'm very interested in any feedback.

Thanks,
Scott

Loading...