Hibernate version:
3
Hello,
We have here an application splitted in several modules. Some of those modules provide beans along with their associated hibernate mapping file (a .hbm.xml in same package as the the class, with same name as the class).
However, maintenance problems arise when it comes to managing all those .hbm.xml.
Currently, in the final application, we have a
Code:
<mapping resource="x/y/Z.hbm.xml"/>
for each class hibernate has to support. It becomes very difficult to maintain as the web application grow, considering we have several developper configurations and a production configuration. We have regulary the problem of a missing mapping reference in the configuration file, when a developper added some beans but didn't update all the configuration files. And of course, until the app try to persist / load that specific bean, errors don't show
Is there some way to tell hibernate to automatically load the .hbm.xml files? If i don't reference the .hbm.xml files in the configuration file, hibernate throws "Unknown entity" exceptions. Why doesn't it try to load the .hbm.xml, considering docs tell us to put that with same name as class, with a .hbm.xml extension and in same package??
as a solution, i tried <mapping package="x.y"/>, considering package are far more stable in the time than their content. However, it doesn't load x.y.*.hbm.xml ?? what is mapping package for? I found no docs about it.
Also, i could use the .jar loading, but again there is no docs about this parameter and, because our module jar have a version number, we hit the same problem of new class, we have to keep the jar name updated each time a module version is modified?
What is the suggested way to handle the most easily all hibernate mappings in a web application?
Thanks