Hibernate Project Creation With NetBeans IDE by R4R Team

Now Open the NetBeans IDE open File Menu Wizard -> New Project

Go-> File Menu Wizard -> Select to New Project -> Select Java web -> and also select web application -> click next ->(As Given in above image)

 Write the project name HibernateWeb1 then click next->(As Given in above image)

Here select server on which you want to build the project -> then Next (As Given in above image)

Search the Hibernate Framework and mark on the hibernate and when mark will be on the one tab will open in the same page select to new connection to make the connection with database -> New Connection Wizard (As Given in above image)

 Now you will see in your Netbeasn IDE acording the given image and  ->select according the image and click next -> and then finish.  (As Given in Below Mentioned image)

Which code we are seeing in the image that are below to understand all points which are used in Hibernate Project creation.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

  <session-factory>

    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate_pro?zeroDateTimeBehavior=convertToNull</property>

    <property name="hibernate.connection.username">root</property>

    <property name="hibernate.connection.password">root</property>

  </session-factory>

</hibernate-configuration>

In the above code we can see the some critical parts which should be always remember.

1. When we make the connection with the database and NetBeans Generate auto hibernate.cfg.xml file. In that file we see our database host name and port name alse.

2. If we given the password in the database then we see the user name and password in the above mentioned code.

3. Till then we don't create the POJO class we can't see the mapping file with the database name and file name also.

4. If all thing are completed then our project created correctly.
Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!