See Configuration.addResource(String) to specify individual mapping files (hbm.xml files) or Configuration.addClass(Class) to specify a class to map. (latter assumes that a mapping file named <ClassName>.hbm.xml exists in the same package directory as the specified class.) These methods look for the specified resources in your classpath, so multiple jars are fine.
You can also specify all mapping resources in your cfg.xml file. If you want to create multiple SessionFactory instances, use one cfg.xml per instance.
I suppose you could call Configuration.configure() multiple times, loading multiple cfg.xml files for one SessionFactory, but I'm not sure what that would do. However, there's nothing in the hibernate-configuration-3.0.dtd that says you couldn't create a mapping file with no properties and just references to mapping resources, effectively specifying a mapped "module" of hbm.xml files. Dunno. Check the source of Configuration.configure() before you try this. :)
From TFM: [url]file:///C:/hibernate/guide3.htm#session-configuration[/url]
|