OK, after hours of reading, this is what I have found out:
* The HARDeployer is removed in favor of the SARDeployer (in later JBoss AS that is, not sure exactly in what version this happened though).
* The SARDeployer then accepts .har archives as well (earlier on, the HARDeployer handled these). In .har files, mapping files are automatically discovered (possibly you need to turn on some configuration for this to happen).
* Using a .har file will utilize the Hibernate jmx bean included in JBoss AS (org.jboss.hibernate.jmx.Hibernate), which differs slightly from the on included in Hibernate itself (se next bullet).
* In the Hibernate distro (I've used 3.2.5), there is a jmx bean (org.hibernate.jmx.HibernateService) that makes it possible to initialize a Hibernate SessionFactory through a (jmx) service. Create a .sar file, define this in the jboss-service.xml, and include the necessary hibernate jars, pojos, mappings. Mapping files are NOT automatically discovered though.
* You could also initialize Hibernate and create the SessionFactory within your code, in the way it's done in the CaveatEmptor.
Regardless which way you go, the SessionFactory is/can be bound to jndi for you to look up when needed.
As I'm using JBoss AS 4.0.2 I've decided to build a .sar file and not use a deployer (I've removed the old included jboss-hibernate.deployer), as I guess it would require quite a bit of work to upgrade it. I decided it would be a nicer solution to have the SessionFactory initialized as a service instead of by static code blocks or some other home-grown solution.
|