A new Eclipse project
Now start Eclipse. You don't have a specific project for Hibernate applications, so a utility project (which simply packs the classes in an archive) will be enough. You can reach this option from the menu by going to New | Other | Java EE | Utility Project.
Name the project HibernateProject and target it to JBoss AS 5.0 Runtime. You can leave the default JBoss AS configuration and hit Finish.
Now, we are going to unleash the full potential of Hibernate tools. Select from the menu New | Other | Hibernate | Hibernate Configuration File. The Hibernate configuration contains all of the details for wiring your application to the database. You will be asked for the name and the parent folder of the configuration file. Accept the default hibernate.cfg.xml at the root of your project.
Next, insert the details of your Hibernate configuration. Choose a name for your SessionFactory, which will contain your MySQL connection facets. Remember to check the flag Create a console configuration, so that the wizard will complete the console configuration as the next step.
A console configuration describes how the Hibernate plugin should interact with Hibernate and what configuration files (including the classpath) are needed to load the POJOs, JDBC drivers, and so on. This step is required to make use of query prototyping, reverse engineering, and code generation.
The console wizard will look at the current selection in the IDE and will try to autodetect the settings, which you can approve or modify to suit your needs. For example, you don't need to enter the Configuration file or the Property file if you have just one in your project; Eclipse will select it automatically.
One important selection is the Type option that lets you choose between the Core hibernate configuration (Java classes backed by mapping files), Annotations, or even JPA annotations. We will leave the selected Core option.
Before clicking Finish, select MySQL (InnoDB) as Database dialect in the Options tab. No other changes are required.
Now verify that you have successfully linked to Hibernate by switching to Hibernate Perspective. This view will be composed by a tree of three objects: Configuration, Session Factory, and Database. Choose Database and verify that it expands correctly to show the database tables of schema.
If you fail to browse the database schema, check that you have correctly set up your Hibernate configuration.