Step 2. Create a new Hibernate Web Application Project

A web application project is an Eclipse project that contains the source code, web pages, images, resources, and configuration files for building a Java program that can be deployed to a Web Container. In this step, you will create a new web application project and review the default artifacts.

The tasks in this step are:

To Create a New Web Application Project

To Review Application Artifacts

To Create a New Web Application Project

  1. Ensure that you are connected to the Internet. In this step libraries and project files will be automatically downloaded from the Oracle website.
  2. Open Workshop in a new workspace. (If Workshop opens in an existing workspace, create a new workspace by clicking File > Switch Workspace then choosing Browse and clicking Make New Folder to create a new workspace folder).
  3. Click New Example Web Project on the AppXplorer view.
  4. In the New Example wizard, choose Hibernate > Workshop Hibernate Tutorial from the list.
  5. Click Next.
  6. The default name for the project is workshop-hibernate-tutorial. You can keep the default name or change it to any name you wish. Click Next.
  7. The next screen is a Hibernate license. Review the license carefully and if you accept the terms, click on I Agree. If you do not agree to the license, then you will not be able to use Hibernate tools and the Hibernate example in Workshop. If you do agree, then the Hibernate libraries will be downloaded and installed.
  8. Review the Java build settings. By default, workshop-hibernate-tutorial/web/WEB-INF/src/java is selected as source folder and workshop-hibernate-tutorial/web/WEB-INF/classes as output folder.
  9. Click Finish to create the new Hibernate web application project.

Review the Web Application Artifacts

Below is the summary of different parts of the web application structure as seen in the AppXplorer view.

app

Folder or file Overview
workshop-hibernate-tutorial Project folder with project name
  /web (Web App Root) Root folder for web application artifacts
    /Faces Configuration Lists JSF configuration elements
    /Hibernate Configuration Displays list of Hibernate persistent entities
    /pages Folder for HTML and JSP presentation pages
    /hsqlDB Hypersonic database files for the underlying database used in the example
    /Resources Supporting files being used in Hibernate application
    /WEB-INF Holds folders / files used as part of the runtime Web application
      /classes Holds class files for the web application
      /config Holds JSF configuration file

      /lib Folder to place third-party .jar files which is used at run-time i.e. .jar file for logging, tag libraries, JDBC drivers etc.
      /src/java Folder to place java source files
      /tld Folder to place tag library definition files
      web.xml Deployment descriptor for web application
  /web/WEB-INF/src/java Folder that maps to src/java folder where you can place java source files
    /resources Folder to place the resource files
      application.properties Application configuration resource file
    hibernate.cfg.xml Hibernate configurations file
  /Referenced Types Java classes referenced by web artifacts

Click one of the following arrows to navigate through the tutorial:


Still need help? Post a question on the Workshop newsgroup.