|
From: Max R. A. <ma...@eo...> - 2002-10-22 16:37:12
|
Hi! While trying to make a build environment that given some ErWin generated SQL generates, some hbm.xml and from this generate java sources for both class and proxy interfaces I have found some shortcomings in the current codegenerator :( 1. Codegenerator does not support composite-id's 2. You cannot generate code from hbm.xml and then generate proxies without manual intervention ;( This is because the proxy generation depends on java reflection and java reflection requires .class files. But if you are using proxies in the hbm.xml file then the generated code cannot compile because it is using the not-yet generated proxy interfaces :) - its a chicken-egg problem :) What I would suggest is to have the codegenerators and proxygenerator use the metadata package instead of parsing the xml manually! What good is that for ? well 2 things: 1. Code for parsing hbm.xml will only be written ONCE! 2. By having the codegenerator and proxygenerator use metadata one is sure they are using the same information to generate the code...(as they do not do know :) Secondly, I would suggest some kind of custom-attribute stuff like the one provided in OJB. Then one could agument the definitions in hbm.xml with custom attributes which could be used for codegeneration and other generic purposes runtime (if it was available via the metadata package) So, e.g. extend ClassMetaData and CollectionMetaData with getCustomAttribute(key) which could be set by a e.g. <customattrib key="relinfo" value="weak reference"/> embedded in <class> tags. Anyone already doing this ? :) /max |