IntelliJ idea 13.x using hibernate + Spring MVC + JBoss 7.1.1

Source: Internet
Author: User
Tags jboss

Original: IntelliJ idea 13.x using hibernate + Spring MVC + JBoss 7.1.1

Starting from 2004. NET up to now. Until recently to do some Java project, if say 100 people write an article about. NET article, it is estimated that the 10 people write the same content. But if 10 people write a Java article, it is really 10 people 10 kinds of writing. This is the most difficult place to start learning is really confused.

Here we are using Hibernate 4.x + Spring MVC 3.x

1. To build a spring MVC project, the first thing to do is add Project Facets, we'll add a hibernate, and then add a hibernate Configuration, That's hibernate.cfg.xml.

2. Add a Resources folder and mark it as the resources root, in which we want to put the generated <classname>.hbm.xml

3. View->tool windows-> Persistence, find this hibernatetest->new->session Factory (here we don't use sessionfactory beans first )

4. Create a Hibernate.cfg.xml file, and we'll put him in the resources folder for the time being. After the build, this configuration XML is still empty, next we will build the configuration

5. Or right-click Hibernatetest->generate persistence mapping->by Database Schema

6. Select the table you want to generate class and HBM, for example we only select one hellotable

7. After the generation is like this, when you want the console to hibernate hql query, he will error, (Do not know why ...) Knowing that the deploy succeeds, the query is normal again)

8. We need to modify the location of the Hibernate.cfg.xml file and the location of the HBM files.

First we need to move the Hibernate.cfg.xml file to the src/.

Second, all the previously generated HBM files are together with class, and now we want to move all the generated HBM files to the Resources folder

9. Open a controller and write a code to insert the database

10. Re-check the settings of the artifacts.

11. Deploy to JBoss

Complete. Code download

IntelliJ idea 13.x using hibernate + Spring MVC + JBoss 7.1.1

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.