JBoss and Hibernate configuration

Source: Internet
Author: User
Tags jboss

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.