Getting Started with Hibernate (1)

Introduction to hibernate

When operating the database, it can be done in an object-oriented way. There is no need to write SQL statements

Introduce constraints

hibernate-core-5.0.7.Final.jar

org.hibernate-hibernate-configuration-3.0.dtd

http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd

new 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">

 The construction of hibernate framework

 

 

Detailed configuration file

 

Detailed explanation of hibernate API

Configuration

SessionFactory

Session

Get a new session Session session = sf.openSession();

Get the session bound to the thread sf.getCurrentSession();

Transaction

 

 

Usage of BeanUtils.populate

BeanUtils is located under org.apache.commons.beanutils.BeanUtils, and the function of its method populate is explained as follows:

Complete method:

BeanUtils.populate( Object bean, Map properties ),

This method will traverse the key in map<key, value>, if the bean has this property, assign the value corresponding to the key to the bean property.

Customer c = new Customer();

BeanUtils.populate(c, request.getParameterMap());

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326957407&siteId=291194637