VietTuts

Tự Học Lập Trình Online

  • Home
  • Java
  • Servlet
  • JSP
  • Struts2
  • Hibernate
  • Spring
  • MyBatis
  • Java WS
  • C
  • C++
  • Python
  • PHP
  • Eclipse
  • VBA
  • Web
    • JavaScript
    • JQUERY
    • JSON
    • AJAX
    • CSS
    • HTML
    • Node.js
    • Angular 7
  • SQL
    • MySQL
    • SQL Server
  • Misc
    • Phần mềm tiện ích
    • Cấu trúc dữ liệu và giải thuật
    • Học lập trình C#
    • Selenium Test

Hibernate Tuts

ORM là gì? Hibernate là gì? Hibernate - Kiến trúc Hibernate - Môi trường Hibernate - File cấu hình XML Hibernate - File Mapping Hibernate - Thuộc tính type Hibernate - Lớp persistent Hibernate - Sessions Hibernate - example Hibernate - O/R mapping Hibernate - Annotations Hibernate - Query Language Hibernate - Criteria Queries Hibernate - Native SQL Hibernate - Bộ nhớ cache Hibernate - Batch processing Hibernate - Interceptors

Hibernate với các ví dụ

Hibernate - many-to-one relationship với MySQL trên Eclipse Hibernate - one-to-one relationship với MySQL trên Eclipse Hibernate - one-to-many relationship với MySQL trên Eclipse Hibernate - many-to-many relationship với MySQL trên Eclipse

Hibernate Tool

Cài đặt Hibernate/Jboss Tools trong Eclipse IDE Tạo Hibernate Configuration (hibernate.cfg.xml) với Hibernate Tools Sử dụng Hibernate Tools tạo các file mapping và annotation

Hibernate 5 Examples

Ví dụ Hibernate 5 XML Mapping – MySQL Ví dụ Hibernate 5 XML Mapping – SQLServer 2017 Ví dụ Hibernate 5 Annotation Mapping – MySQL Ví dụ Hibernate 5 Annotation Mapping – SQLServer 2017

Hibernate 4 Examples

Ví dụ Hibernate 4 XML Mapping – MySQL Ví dụ Hibernate 4 XML Mapping – SQLServer 2017 Ví dụ Hibernate 4 Annotation Mapping – MySQL Ví dụ Hibernate 4 Annotation Mapping – SQLServer 2017

Hibernate 3 Examples

Ví dụ Hibernate 3 XML Mapping – MySQL Ví dụ Hibernate 3 XML Mapping – SQLServer 2017 Ví dụ Hibernate 3 Annotation Mapping – MySQL Ví dụ Hibernate 3 Annotation Mapping – SQLServer 2017

Phỏng vấn Hibernate

List câu hỏi phỏng vấn Hibernate

Tạo Hibernate Configuration với Hibernate Tools


Hibernate là gì?
Hibernate many-to-many relationship với MySQL trên Eclipse

Bài này hướng dẫn bạn Tạo Hibernate Configuration với Hibernate Tools (hibernate.cfg.xml) with Hibernate Tools. Tạo "hibernate.cfg.xml" kết nối với MySQL database.

Đầu tiên bạn phải cài đặt plugin như trong bài hướng dẫn cài đặt Hibernate/Jboss Tools trong Eclipse IDE.

Các tools được sử dụng trong bài này:

  • Eclipse 4.7 oxygen.
  • JBoss Tools 4.5.2.Final Eclipse plugin.
  • MySQL 10.1.29-MariaDB (from xampp-win32-7.2.0-0-VC15-installer).

Nội dung chính

  • 1. Show Hibernate Perspective
  • 2. Create New Hibernate Configuration
  • 3. Result

1. Show Hibernate Perspective

Select "Windows" --> "Perspective" --> "Open Perspective" --> "Others..." --> choose "Hibernate".

Generate Hibernate Configuration File With Hibernate Tools

2. Create New Hibernate Configuration

In Hibernate Configuration, right click and select "Add Configuration..."

Generate Hibernate Configuration File With Hibernate Tools

In "Edit Configuration" dialog box:

  1. In "Name" box, input your configuration name.
  2. In "Hibernate Version" dropdown, select Hibernate Version.
  3. In "Project" box, click on the "Browse..." button to select your hibernate project.
  4. In "Database Connection" box, click "New..." button to create your database settings.

    Generate Hibernate Configuration File With Hibernate Tools
  5. In "Configuation File" box, click "Setup..." button to create new or use existing hibernate configuration file (hibernate.cfg.xml).

    Click "Create new..." to create new hibernate configuration file (hibernate.cfg.xml):

    Generate Hibernate Configuration File With Hibernate Tools
  6. Select your hibernate project and folder to create hibernate configuration file (hibernate.cfg.xml).

    Generate Hibernate Configuration File With Hibernate Tools
  7. Input your MySql database information:
    Generate Hibernate Configuration File With Hibernate Tools
  8. Click "Finish" button.

3. Result

File: hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class"> 
            com.mysql.jdbc.Driver
        </property>
        <property name="hibernate.connection.url"> 
            jdbc:mysql://localhost:3306/testdb
        </property>
        <property name="hibernate.connection.username"> 
            root
        </property>
        <property name="hibernate.connection.password">
            1234567890
        </property>
        <property name="hibernate.dialect"> 
            org.hibernate.dialect.MySQLDialect
        </property>
    </session-factory>
</hibernate-configuration>

Hibernate là gì?
Hibernate many-to-many relationship với MySQL trên Eclipse

Recent Updates

Ví dụ Hibernate 3 XML Mapping - SQLServer 2017Ví dụ Hibernate 4 Annotation Mapping - MySQLVí dụ Hibernate 4 Annotation Mapping - SQLServer 2017Ví dụ Hibernate 4 XML Mapping - MySQLVí dụ Hibernate 4 XML Mapping - SQLServer 2017Ví dụ Hibernate 5 Annotation Mapping - MySQLVí dụ Hibernate 5 Annotation Mapping - SQLServer 2017Ví dụ Hibernate 5 XML Mapping - MySQLVí dụ Hibernate 5 XML Mapping - SQLServer 2017Ví dụ về HibernateSự khác nhau giữa MyBatis và HibernateList câu hỏi phỏng vấn Hibernate

VietTuts on facebook

Học Lập Trình Online Miễn Phí - VietTuts.Vn

Danh sách bài học

Học java
Học servlet
Học jsp
Học Hibernate
Học Struts2
Học Spring
Học SQL

Câu hỏi phỏng vấn

201 câu hỏi phỏng vấn java
25 câu hỏi phỏng vấn servlet
75 câu hỏi phỏng vấn jsp
52 câu hỏi phỏng vấn Hibernate
70 câu hỏi phỏng vấn Spring
57 câu hỏi phỏng vấn SQL

About VietTuts.Vn

Hệ thống bài học trên VietTuts.Vn bao gồm các bài lý thuyết và thực hành về các công nghệ java và công nghệ web. Các bài lý thuyết trên hệ thống VietTuts.Vn được tham khảo và tổng hợp từ các trang http://javatpoint.com, http://www.tutorialspoint.com, http://docs.oracle.com/en …

Scroll back to top

Copyright © 2016 VietTuts.Vn all rights reserved. | VietTuts.Vn team | Liên hệ | Chính sách - riêng tư | sitemap.html | sitemap_index.xml