BCEL 是可以动态在内存中创建class的。The Byte Code Engineering Library is intended to give users a convenient possibility to analyze, create, and manipulate (binary) Java class files (those ending with .class). Classes are represented by objects which contain all the symbolic information of the given class: methods, fields and byte code instructions, in particular.
.addResource("Item.hbm.xml")
.addResource("Bid.hbm.xml");
另外再看看hibernate文档的第5章 5.4. 动态模型(Dynamic models)
throws HibernateExceptionpublic Configuration addFile(File xmlFile)
throws MappingException用文件的绝对路径,保证每次获得的是文件的最新内容就可以动态修改内存中的o/r映射。
他内部维护一堆Map和List,所以会把旧内容覆盖。
但是,不会删除已加载的关联(xxx-to-xxx)等,这个还没测试过有多少影响。
需要扩展出一堆removeXXX的方法来做对应的动作。
他们经常说“这个东西我在xx项目这样...使用”,很少看到“这个东西实现方式是...所以我们这样...会比较好”。只有应用没有研究,缺乏深度。这点javaresearch比他们强。