How to deploy Hibernate application on JBoss server - help necessary
posted 3 years ago
I am looking for a good description how to deploy hiberante libraries and application (for example EJB that uses Hibernates Seesion for performing some database actions ) on JBoss (I use 6 version) and I can't find a consistent approach to this case. Can anyone put some light on this issue because I'm wasting hours on thing that I susspect should be easy with appropriate instructions.
I was reading some articles like this:
http://www.datadisk.co.uk/html_docs/java_app/jboss5/jboss5_deployment.htm http://www.packtpub.com/article/developing-applications-with-jboss-and-hibernate-2?utm_source=rk_jboss5_abr3_0110&utm_medium=content&utm_campaign=ramsai and I am getting mor confused.
Please let someone explain me some basic things.
Lets assume that I want to make an EAR with EJB that usese Hibernate libraries.
First of all where should i place Hibernate Libraries ? Sshould they be in thie EAR (lib directory) or should they be deployed on server (servers "lib" directory)?
In the articles given above they don't mention about it.
They are using some service-hibernate.xml file in this projects for (as I susspect ) configuring SessionFactory. But does it mean that basic configuration file hibernate.cfg.xml is no longer needful? As I was convinced the cfg.xml is a basic file for Hibernate and there should be placed settings for configuring SessionFactory in managed environment (server). I am thinking about properties for SesionContext, JTAFactory or Transaction Manager Lookup. Should I set those properties in service-hibernate.xml instead of cfg.xml?
What about utility class usually named as HibernateUtil which was producing SessionFactory singleton instance from cfg? Is it needless too? What causes SessionFctory to be created? server itself without any "builtSessionFctory()" call?
There is reportedly a second approach to this development with JMX service. But it is not well described too. In some articles it is mentioned taht I have to add only jboss-service.xml file to Meta-INF of my EAR. In some places they write that I should bulid special SAR archieve with this jboss-service.xml and Hibernate libraries.
Does this approach not use cfg.xml file and HibernateUtil class too?
If you have any information about it or link to good article (on time), please write it down because I am really tired with this subject.