Add, delete, modify, and query hibernate associated objects ------ query, hibernate ------
This blog post is the addition, deletion, modification, and query of hibernate-related objects in the previous blog. the settings of this Code have been written in the previous article. Therefore, before reading this article, please move to the previous blog
// Code piece
How Hibernate works, hibernate1. How does Hibernate work and why?
Principle:
1. Read and parse the configuration file
2. Read and parse the ing information and create SessionFactory
3. Open Sesssion
4. Create transaction Transation
5. Persistent operations
6. Submit the transaction
7. Disable Session
8. Disable SesstionFactory
Why:
1. The code for JDBC database access is encapsulated, which greatly simplifi
Simple Example of Hibernate, simple example of Hibernate
First, we can create a new project, Java project or Javaweb project, and then import the jar required by hibernate. The jar package I use is as follows:
Create an object class Teacher. java and add the get and set methods:
1 public class Teacher { 2 private String username; 3 private String passwo
As usual, create a new Studentmap.java entity class and store the hobby attribute using the Map collection interface: Packagecom.joe.entity;ImportJava.util.Map; Public classStudentmap {Private intID; PrivateString name; Private intAge ; PrivateMapHobby; /*** No parameter constructor*/ PublicStudentmap () {} Public intgetId () {returnID; } Public voidSetId (intID) { This. ID =ID; } PublicString GetName () {returnname; } Public voidsetName (String name) { This. Name =name; } Pu
XML version= "1.0" encoding= "UTF-8"?>DOCTYPE hibernate-mapping SYSTEM "Http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">hibernate-mapping> a class tag corresponds to an entity class, the name attribute specifies the entity class name, and the table property specifies the associated database table - classname= "Com.joe.entity.StudentS
Detailed description of hibernate automatic table creation configuration, detailed description of hibernate Creation
Detailed description of the configuration of automatic table creation by hibernate
Configure Automatic table creation:
Update: automatically updates the table structure based on the model object. When hibernate
/**
Author: willpower
Source: rifoo Technology (http://www.rifoo.com)
Date: 2006-06
Remarks: Reprinted please keep the above statement
**/
Today, let's take a look at the hibernate configuration file. There are two types: Property file and XML file.
Hibernate property File(Default hibernate. properties ):1. You can configure JDBC connections.2. If JDBC is manage
[Web Development Learning Notes] Hibernate learning summary, learning notes hibernateHibernate learning notes part: This part of learning is easier, the code is more comprehensive, and easy to understand. It can be said that it is something of a memory nature. I did not take notes myself during my learning process. I just referred to the learning notes I found online. I learned and reviewed the notes quickly. Some jar packages are missing in the sourc
Hibernate search policy and Hibernate search policy
The session in hibernate loads a persistent object according to load () and get () according to the parameter formulation OID (ObjctID. In addition, the Query. list () method loads persistent objects according to HQL statements.
The above methods can be used to load persistent objects of
In the actual development process, many users need to sort and display the query results as needed, instead of displaying the results in a disordered order in the database, in this case, we have to sort the data. hibernate provides good support for data sorting. hibernate provides two types of sorting for the queried data results: 1: Database sorting, that is to say, the sorting is completed within the data
Hibernate cache
cache: A very general concept in the computer domain. It is between an application and a persistent data storage source, such as a file on disk or a database, and it works by reducing the frequency with which the application directly reads the permanent data storage source, thereby improving the performance of the application. The data in the cache is a copy of the data in the data storage source. The physical media that is cached
In the article "Hibernate" Hibernate's clustering query, group query, sorting and time difference (click to open link), it has been described how to use HQL statements instead of SQL statements. queries that cluster queries, group queries, sorting and time differences, at the same time, point out that hql can do whatever it takes to replace SQL statements. I originally thought that the HQL statement the Multi-table query, must first to the inside the
1 First download Hibernate package address: http://hibernate.org/orm/2 Create a new Web project, add Hibernate lib Reference package (the first step of the extracted files in the Lib folder under the required folder under the directory of the jar to copy to the Web project Webroot Web-inf Lib)3 File structureThe 4 test class is used as a testing effect: code: PackageCom.sinosoft;Importorg.hibernate.Session;
Hibernate it's a lightweight. ormapping Framework. Learn entityframework , will feel very kind. For various levels of programmer design of the database:The monkey does this: first consider the storage of data, the implementation of the function, how to facilitate how to. As for the redundant God horse, do not consider.Senior Program Apes do this: first design a relational model of the database, draw with tools ER diagram, or draw a physical model. Con
In the last blog post hibernate from Getting started to proficient (ii) Hibernate example Demo we have a simple understanding of the basic use of hibernate through an example demo, here we briefly review the hibernate framework of the use of steps.
Steps to use the Hibernate
First, the origin of the frameworkQuick Start
For more information about frames, see the framework's official homepage!The idea of this framework is to draw on the Java platform's hibernate and IBatis, with the features of ORM and Sql-map, as well as reference to later. NET LINQ (This framework was formed in 2006, when it was not yet heard of LINQ) using styles, OQL query expressions were designed. The concept of this framework is univer
Today, a friend from the group (Java Coder group: 91513074) asked me how to read the help documentation or solve the problem. I hope I can introduce my methods.In fact, this OneCoder is not qualified to talk about it. You can only talk about your habits and methods. Self-learning and self-solving are indeed a very important capability, far more important than the knowledge you have now, because you are always unknown.About API documentationSome people often ask for various API documents. The mos
For Java beginners, want to learn the Java tutorial, need to understand that the foundation is good to learn better, Java Tutorial Learning Java Roadmap Five of the necessary stages, hoping to help Java learners.
The first phase- Java Foundation Phase
1.java syntax2. Object-oriented3. Commonly used APIs4. Interface Programming5. Multithreading6. File IO7.java network programming.
This is the basic stage of learning Java development, but also the c
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.