Hi all,
We're using Hiberate 3.1.3 + Spring 2.0.2 + Maven to implement a web application. The application has been partitioned into 10+ Maven modules, some of which have persistence e.g. Employee Mng and Order Mng. These modules are combined as maven dependencies within the parent web app. A couple of the modules are used standalone in other apps.
Currently each module with O/R requirements contain distinct:
* hibernate mapping files
* hibernate session factories
* DAO + DTO definitions
As a result we:
a) have multiple hibernate sessions at runtime for each distinct persistable module. We cannot therefore use hibernate to easily cross the module boundaries with mappings, and
b) if we need to use a object in another module it has to be eagerly loaded - a big perfomance issue
We tried to define a Session factory in the parent web app module but couldn't seem to get Hibernate to detect the mapping files available in each JAR dependency.
I'd welcome any guidance on the best practice in terms of combining multiple modules that each contain groups of persistable objects?
Specific questions include:
* can each JAR file include its own mapping files?
* should there only be 1 master session factory definition
* any good reference applications illustrating this?
All help appreciated.
Shaun
|