shaoanqing wrote:
the classes is uploaded by another mode,and I load them using classloader.
so,the classes is dynamic.
I want to generate @annotation or generate mapping files dynamicly to saving them by hibernate.
The question is both @annotation and mapping files is not exist!
how can i generate one of them dynamicly?
I have to say you have an unique and weird setup here :) If the db exists, you can reverse engineer to generate the mapping files assuming they're corresponded to the classes uploaded, however, it does NOT reserve all schematics (relationships, constraints, etc.). Otherwise, I'm sorry I don't know any other way. (This is ad-hoc but you can try to use reflection on the domain model classes and generate the mapping files, but I would not go there if I were you!)