Alibabacloud.com offers a wide variety of articles about java persistence with hibernate second edition, easily find your java persistence with hibernate second edition information here online.
Hibernate is an open-source object relationship ing framework. It implements lightweight object encapsulation for JDBC, so that Java programmers can use the object programming thinking to manipulate the database as they wish. It not only provides ing between Java classes and data tables, but also provides data query and recovery mechanisms. Compared with using JD
This article will introduce the CRUD operation examples of persistence classes with List attributes in Hibernate. If you are interested, please refer to them.
1. hibernate. cfg. xml
The Code is as follows:
Copy code
"-// Hibernate/Hibernate Configurat
http://blog.csdn.net/yerenyuan_pku/article/details/65462930Hibernate Persistence ClassWhat is a persistent class? The English name of the persistence class in Hibernate is Persistent Object (PO), PO=POJO+HBM mapping configuration file.For the PO in Hibernate, the following rules are written:
You must provide a
1. hibernate. cfg. xml The code is as follows:Copy code "-// Hibernate/Hibernate Configuration DTD 3.0 // EN"Http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd> 2. Persistence class Member. java The code
Hibernate Persistence class
What is a persistent class? The English name of the persistence class in Hibernate is Persistent Object (PO), PO=POJO+HBM mapping configuration file.For the PO in hibernate, there are rules for writing: You must provide a parameterless public con
Hibernate Persistence principlesPersistence java classes must follow the following principles:1. This class usually requires an id. We recommend that you use the encapsulation type.2. This class cannot be modified by final.3. You need to provide a non-parameter constructor for this class.4. The getter/setter method must be provided for all attributes.5. If operat
exists in the data table, an exception is thrown: java. lang. IllegalArgumentException12. Hibernate calls the native jdbc api:Session. doWork(New Work(){@ Override public voidExecute(Connection connection)Throws SQLException{//Use the JDBC native API}});What are the three persistence states of hibernate objects?
Insta
PO persistence object and PO in hibernate
I. Understand the persistence object PO:
In hibernate applications,Each table in the database corresponds to a persistent object PO.. PO can be viewed as a java object mapped to a database table. The simplest PO corresponds to a reco
Hibernate Object Persistence frameworkJDBC :( Java Data Base Connectivity) java Database Connection
The java. SQL package provides JDBC APIs to write program code for accessing the database. common interfaces and classes include the following:
DriverManager: Driver manager,
JDBC: (Java data Base Connectivity)Java database connection The java.sql package provides the JDBC API through which you can write program code to access the database. The interfaces and classes that are used frequently include the following:
DriverManager: Driver Manager, responsible for creating database connections
Connection: representing the database connection
Statement: Responsible
From the perspective of persistence, Hibernate divides objects into four states: Persistence State, temporary state, free state, and delete state. The Session method can convert objects from one state to another.Temporary object in the Persistent Object state (Transient ):
-When the proxy primary key is used, the OID is usually null-not in the Session cache-no
JDBC: (Java data Base Connectivity)Java database connection The java.sql package provides the JDBC API, which allows you to write program code that accesses the database. Common interfaces and classes include the following:
DriverManager: Driver Manager, responsible for creating database connections
Connection: representing the database connection
Statement: Responsible for executing SQL s
Hibernate is an object-relational mapping solution under the Java language. It is a free, open source software issued using the GNU Wide general Public License. It provides an easy-to-use framework for the mapping of object-oriented domain models to traditional relational databases. Hibernate is also currently the most popular database
Hibernate is an object-relational mapping solution under the Java language. It is a free, open source software issued using the GNU Wide general Public License. It provides an easy-to-use framework for the mapping of object-oriented domain models to traditional relational databases. Hibernate is also currently the most popular database
The interview was asked, maybe understood, but not clear.Hibernate is a framework for ORM (object relation Mapping, objects relational mapping), so-called object-relational mapping, which, in layman's words, is to save Java objects in a relational database. What hibernate does is to project the object into a relational database and then implement persistence. It
without reference to any framework, we will continue to operate the database through trivial code, resulting in a lot of redundant but regular low-level code, so the frequent operation of the database and a large number of low-level code of repeated writing greatly wasted the program staff's writing, in such a case, The hibernate framework emerged.In fact, hibernate package is model models, the encapsulatio
without reference to any framework, we will continue to operate the database through mediocre code, resulting in a very large number of redundant but regular low-level code, so the frequent operation of the database and a large number of low-level code of repeated writing greatly wasted the program staff's writing. In such a case, the hibernate framework emerges.In fact, Hibernate is packaged in model model
Persistent object uniquely identifies--oid1) The primary key in the database can be used to distinguish whether two objects are the same2) Whether the memory address of the object used in the Java language distinguishes between objects3) Use OID in Hibernate to distinguish objects from the sameHibernate considers that each of the different objects should have a unique identifier, which is called the OID;In
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.