1 Installing JBoss
2 setting environment variable, jboss_home for JBOSS installation directory
3 Deploy the application, assuming the application project name is MyProject, the application project deployment location is Jboss_homeserverdefaultdeploymyproject.har Create Myproject.war,meta-inf in this directory, two directories, and the Web application is placed under the war directory.
The Meta-inf directory is where the Hibernate-service.xml file is placed to configure the Hibernate, and then the Hibernate data model that will be built on its own is also placed under the Har directory.
The following is the contents of the Hibernate-service.xml configuration file
<?xml version= "1.0" encoding= "UTF-8"
<server>
<mbean code= " Org.jboss.hibernate.jmx.Hibernate "Name=" "Jboss.har:service=hibernatefactory"
<!--set in JBoss jndi-->
<attribute name= "DataSourceName" >JAVA:/MYSQLDS</ATTRIBUTE>
<!--set dialect;
< Attribute name= "dialect" >net.sf.hibernate.dialect.mysqldialect</attribute>
<!--
Set sessionfactory and Jndi mappings, the Jndi name of
that is invoked when the Sessionfactory instance is created in Sessionfactroy.java will be the name set here instead of the data source name.
;
<attribute name= "Sessionfactoryname" >JAVA:/HIBERNATE/HIBERNATEFACTORY</ATTRIBUTE>
<!--provides a custom cache provider;
<attribute name= "Cacheproviderclass" > Net.sf.hibernate.cache.hashtablecacheprovider</attribute>
</mbean>
</server>
4 Configuration JBoss Data source, data source description file examples can be found in jboss_home/docs/examples/jca, according to the actual situation to configure the data source information, the configuration of the file in Jboss_homeserverdzhdeploy, the file in the <jndi-name>MySqlDS</jndi-name> to and Hibernate-service.xml file <attribute name= "DataSourceName" >java :/mysqlds</attribute> corresponds.
5 run Run.bat and use the parameter-C MyProject to make the deployed application run