1) instantaneous status
This instance was just created with the new statement and has not been persisted. It is not in the cache of any session, and it has no object identifier (primary key );
Features:
It is not associated with any session instance and has no corresponding records in the database.
2) Persistence status
The instance has been persistently added to the session cache. The instance is currently associated with a session instance
People who have tried DAO by using Hibernate reverse engineering have tried the DAO package method
But these are not to be used casually, subject to the principle of object-oriented.
Example: School has a lot of students 1 to n relationship
I'm going to look for all the students in "the second primary school."
If we use the knowledge of data structures to write code
This seems to be possible (error demonstration, in fact, in the object-oriented insi
Persistence java classes must follow the following principles: 1. this class usually requires an id. we recommend that you use encapsulation type 2. this class cannot be modified by final. you need to provide a non-parameter constructor for this class. 4. you need to provide the gettersetter method for all attributes. 5. if the operation involves the set data, the set type should use the interface type, Lis
Ø instantaneous object (transient objects): use new
The object initialized by the operator is not immediately persistent. Their statuses are instantaneous, that is, they do not have any behavior associated with the database table, as long as the application no longer references these objects (no longer referenced by any other objects ), their status will be lost and recycled by the garbage collection mechanism. Persist objects: a persistent instance is any instance with a database ID. The
JPA uses JDK 5.0 annotations or XML to describe the ing relationship between objects and Relational Tables, and persistently stores object objects in the database at runtime.Sun introduced the new jpa orm specification for two reasons: first, simplified the development of Object Persistence for existing Java EE and Java SE applications; second, sun wanted to inte
Java ee5, as the specification of the next-generation Java Enterprise Development Platform, has attracted the attention of the entire Java Development Community since its design. It has aroused numerous debates and raised numerous expectations. Java ee5, nearly six years after its birth as a J2EE platform, focuses on s
14 skills for high-performance Java persistence, high-performance java
A high-performance data access layer requires a lot of knowledge about the database, JDBC, JPA, and Hibernate. This article summarizes some important technologies that can be used to optimize enterprise applications.
1. SQL statement log
If you use
This article introduces a design method of Java platform and Enterprise Edition (Java ee 5), which utilizes the new Java persistence API (JPA) of Enterprise JavaBeans (EJB) 3.0 ). JPA provides a standard Object link ing solution that avoids dependency on third-party frameworks (such as
and cons. In the "Select" section, I'll talk about how to choose the framework; in the "Timing" section, I'll discuss scenarios where you should consider application frameworks and scenarios where you should look for alternatives; and finally, in the "Pros and cons" part, I'll discuss when you decide to adopt a framework, All the advantages and disadvantages of the framework. The first thing to discuss here is the most famous framework in the Java
Today I went to the Java Programmer's recruiting information and saw that some companies also need to master the framework of the Ibatis persistence layer in addition to the hibernate, so I searched the internet for a bit, and it was a nice piece of writing.
I in the initial selection, considering Ibatis and hibernate
The JPA spec. Defines the JPA annotation in the package javax.persistence .Hibernate isn't only implements JPA spec, but extends it to adds more features. So, Hibernate creates their own annotations which just extend the JPA annotation with the hibernate features, and put th ESE annotation inside the packageorg.hibernate.annotationsIf There is no
the entity is separated from the entitymanager ( 4 ) is deleted: when Entitymanager called Remove method deletes the specified entity, the entity enters the deleted state, the deleted entity also has a persistence context associated with it, and its corresponding record is about to be deleted from the database. Evolution diagram of the entity state:about the JPA There 's a lot of knowledge, it's just fur, but with what I've learned before
Since the drafting of the EJB 3.0 specification, Java classes have always had a single and standard persistence mechanism in both client and server applications. Java 5's annotations (annotation) function is easy to use. This article describes how to use it.
Keep Java classes; there are already many ways to do this, an
java face test-persistence layer 10
91, what is ORM.Object-Relational mapping (object-relational Mapping, or ORM) is a technique to solve the problem of mismatch between the object-oriented model of program and database;
To put it simply, ORM is to automatically persist objects in a program to relational databases or to convert rows from relational database tables into
performance, and we can analyze it through the statement log of the database service. Many o/rm can automatically generate table schema (automatically generate tables) based on mapping instructions, but we should not do so, especially in production environments or products, remember that we should design our own tables. If the table design is poor, it is your fault, not o/rm. Java Persistence API
There are
Differences and relationships between JAVA serialization and persistence, java serializationPersistence: stores data (such as objects in memory) to permanently stored storage devices (such as disks ). The main application of persistence is to store the objects in memory in a relational database. Of course, they can als
statements are provided at the same time, joined employs data integrity restrictions. This strategy is fine as long as you don't use a basic type of polymorphic query or @onetomany Association. Its real function is to correlate the polymorphic @manytoone supported by the policy pattern on the data access layer.You should avoid using table_per_class because it does not generate a valid SQL statement.9. The size of the persistence contextWhen using JPA
development can save a lot of code, improve efficiency. But Hibernate's disadvantage is that the learning threshold is high, mastering the threshold is higher, and how to design the O/R mapping, how to trade off between performance and object models, and how to use hibernate with great experience and ability.In short, in accordance with the needs of users in a limited resource environment as long as the maintenance and extensibility of a good softwar
. Hibernate can be used in any situation where JDBC is used. It can be used in Java client programs or Servlet/JSP web applications. The most revolutionary is that, hibernate can replace CMP in the J2EE architecture of application EJB to fulfill the task of data persistence.
From the Baidu business card above, we can s
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.