One: IntroductionHibernate is the DAO layer in Java, which deals with persistent layers. The underlying is also database driven, connected, and so on. He also has an ORM, class, and database mapping.II. deployment: Https://sourceforge.net/projects/hibernate/?source=typ_redirect1) Package Description:2:) CREATE Database1 CREATE TABLE customer (ID BIGINT not NULL auto_increment primary key,name varchar), Ipon
in the Free State, it must be initialized during persistence.
Applicability
One-to-many or many-to-many Association.
Objects that the application does not need to access immediately or are not accessible at all.
Left Outer Join search policy
By default, multiple-to-one join uses the left Outer Join retrieval policy.
If you set the outer-join attribute of the
• The following program code:
Order order=(Order)session.get(Order.class,new Long(1));
1, three layer architecturePresentation Layer Web layer (MVC is a design model of a presentation layer)Business Layer Service LayerPersistence Layer DAO Layer2. The relationship between the three frameworks and the three-tier architecture (it is recommended to learn the order of the three frameworks: Learning Hibernate before learning STRUTS2 framework and finally learning Spring framework)Hibernate framewo
This class is a tool for loading hibernate resources. Three types of loading classes of JDK are used during resource loading.
1. Current Thread class loader
Classloader contextclassloader = thread. currentthread (). getcontextclassloader ();
2. Current Class Loader
Classloader contextclassloader = confighelper. Class. getclassloader ();
3. System Class Loader
Classloader contextclassloader = classloader. getsystemclassloader ()
Load in sequence accor
Java Hibernate objects
Thanks to the recent learning of Java Hibernate, there are several states of Java Hibernate Objects sorted, and interested friends can look at it.
instantaneous (transient): There is no data in the databa
Label:(2010-07-14 19:53:50) reproduced
Tags: gossip
Category: JAVA
Hibernate API IntroductionIts interface is divided into the following categories: L provide access to the database operation interface; L interface for configuring Hibernate; L Callback interface L extend Hibernate's function. Most of these interfaces are locat
" identifier generator, Hibernate cannot be in the JDBC layer for BULK insert operations. 3. when doing bulk operations. We recommend that you turn off hibernate 's second-level cache. the Session is cached as hibernate 's first-level cache, which is typically a transaction-scoped cache. Each transaction has a separate first-level cache. sessionfactory the extern
Example data table: Team (class), Certificate (ID card), student (student)
Team. HBM. xml
Http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd>
Mapping File autogenerated by myeclipse persistence tools
-->
Lazy = "true" > Lazy = "true" >
Certificate. HBM. xmlHttp://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd>Mapping File autogenerated by m
When a relational database tries to store terabytes of data in a single table, total performance is often reduced. Obviously, indexing all the data is time-consuming not only for reading but also for writing. Because NoSQL data stores are especially good for storing large data (such as Google's Bigtable), it is clear that NoSQL is a relational database method. For developers who tend to use acid-ity and entity-structure relational databases, and for projects that require this structure, segmenta
in my last Post, " " Java " Itoo the actual project Hibernate Lazy Load Optimization Performance "I have mentioned that student data has 2 million, query data is very slow, this is a very difficult thing to see the page progress bar has been rotating circles, the feeling of anxious really can't describe. The first consideration was to use lazy to optimize, because the foreground frame reason,lazy optimizati
.Because the Bo1 is a persistent object, and the persistent object changes, the session hears this change and produces a corresponding SQL guarantee that the objects in memory and the data in the database will be consistent after the transaction commits. When you execute to the Coustomer.setname () method, the persisted object changes and the session produces an UPDATE statement. After commit, the UPDATE statement is sent to the database and updated.So this object does not need to call the updat
first-level cache for each transaction. sessionfactory 's external cache is Hibernate 's second-level meat dishes, which is an application-wide cache, and all transactions share the same second-level cache. In any case,hibernate 's first-level cache is always available,andhibernate 's second-level cache is off by default, but can also be manually turn off level two caching in Hibernate's configuration f
When creating a new project today, for convenience, we chose hibernate to automatically generate the ing file and Java entity class, but there was a problem;
First, describe the following scenario: In myeclipse, I have already imported many projects. I did not delete them because of project modifications,
However, when I automatically generate a ing file according to myeclipse, I encountered a problem s
1, to the Java project, do database migration, will use the data script.2. When hibernate is introduced, you can create a configuration file for a database table. Tables can be built automatically in the database based on the table's configuration file. ( the database should be pre-built, because hibernate will only build tables and not build libraries )Steps:1),
Used in recent work, save a copy.Java data type, Hibernate data type, corresponding tables between standard SQL data types
Java Data Type
Hibernate Data Type
Standard SQL data type(PS: different databases may be different)
Byte, java. Lang. byte
Byte
Tinyint
Short,
Let's talk about the criteria query, which is easy for us programmers who are not too familiar with SQL statements.Don't say much nonsense, take a look at the example:The entity classes are as follows:
public class User implements serializable{
private static final long serialversionuid = 1L;
public Long ID;
private String name;
private int age;
Omit Get/set Method
}
Mapping file We will not write a very simple entity, if you do not understand the children's sh
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" > Driver--> for
2. Pen.java of persistent type
The code is as follows
Copy Code
Package Org. Rudiment.hibernate; public class Pen
I wrote about the basic operations of JDBC in my previous blog. Today I am going to write an article about the Java reflection mechanism, because the reflection mechanism of Java and the previous JDBC are the basic elements of the Hibernate framework. In the running mechanism of hibernate, the two pieces of content are
Three States of java objects in Hibernate: hibernatejava
Transient status (Transient)
After an object is created through new, the object is not immediately persistent, and it is not associated with the data in the database. At this time, the state of the Java object is instantaneous.
Session knows nothing about Java
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.