Java Hibernate Quick Start

Source: Internet
Author: User
Tags file copy postgresql jboss root directory tomcat log4j

In fact, hibernate itself is a stand-alone framework that does not require the support of any Web server or application server. However, most hibernate introductory introductions have added a lot of hibernate things, such as Tomcat, Eclipse, Log4j,struts, XDoclet, and even JBoss. This is easy to produce hibernate complex and difficult to understand the misunderstanding, especially the impact of the enthusiasm of beginners.

In this article will not involve Eclipse, log4j, Struts, Tomcat, XDoclet, and JBoss. The purpose of this article is to demonstrate the hibernate installation process as well as the most basic functions, so as to give beginners a low can not be lower entry threshold.

Download files

You need the Java SDK, hibernate package, ant package, and JDBC Driver.

1, Hibernate package download Address:

Http://prdownloads.sourceforge.net/hibernate/?sort_by=date&sort=desc

2, ant package download Address:

Http://apache.130th.net/ant/binaries/apache-ant-1.6.1-bin.zip

3, JDBC driver according to your database to set, general database on the official website will have. Hibernate supports commonly used database, such as MySQL, Oracle, PostgreSQL, and Ms-sql Server. These databases all have JDBC Driver:

Oracle JDBC driver Download address (Oracle Agreement must be agreed before downloading)

Http://otn.oracle.com/software/htdocs/distlic.html?/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html

MySQL JDBC driver Download Address

Http://dev.mysql.com/downloads/connector/j/3.0.html

PostgreSQL JDBC driver Download Address

Http://jdbc.postgresql.org/download.html

Ms-sql Server JDBC driver download Address

http://www.microsoft.com/downloads/details.aspx?FamilyID=9f1874b6-f8e1-4bd6-947c-0fc5bf05bf71&displaylang=en

4, the Hibernate package and ant package extracted to C:\dev\ (this directory is not important, you can change any other directory).

Configuring the Environment

1, you need to add a new environment variable: ant_home, let it point to c:\dev\< your ANT package directory >. and add%ant_home%\bin to the PATH environment variable.

2, you need to add a new environment variable: java_home, let it point to your J2SDK root directory. and add%java_home%\bin to the PATH environment variable.

3, create a project directory, such as C:\workspace\My1stHibernate.

In the project directory, create three additional directories: SRC, classes, lib.

In the Lib directory, create two directories: Hibernate and DB.

So you have the following file structure:

c:\workspace\My1stHibernate\
c:\workspace\My1stHibernate\src
c:\workspace\My1stHibernate\classes
c:\workspace\My1stHibernate\lib
c:\workspace\My1stHibernate\lib\hibernate
c:\workspace\My1stHibernate\lib\db

4, will c:\dev\< your hibernate package directory >\hibernate2.jar file copy to C:\workspace\My1stHibernate\lib\hibernate.

Copy all files under the directory >\lib\ your hibernate package to c:\workspace\My1stHibernate\lib\hibernate under c:\dev\<.

Copy your JDBC driver file (typically a jar file) to c:\workspace\My1stHibernate\lib\db.

Related Article

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.