ylbtech-ORM: Wikipedia |
1. Back to top |
1、
Object-Relational Mapping (Object Relational Mapping, referred ORM)
is described by using a mapping between database objects and metadata , object-oriented object language program automatically persisted to a relational database
. Essentially data is converted from one form to another form.
This also implies additional execution overhead
; however, if the ORM as a kind of middleware, will have the opportunity to do a lot of optimization, which in handwritten
persistence layer
does not exist. More importantly, the metadata for the control of the conversion need to provide and manage; but again, these costs than to maintain hand-written programs less; and even comply with ODMG object database specification still requires class-level metadata.
- Chinese name: object-relational mapping
- English name: Object Relational Mapping
- Nickname: ORM
- Applicable range of areas: program development
table of Contents
definition
Object - relational mapping (Object / Relation Mapping, referred to as ORM), along with
object-oriented
of
software development methodology
development arising. Object-oriented development approach is to mainstream development approach today's enterprise-class application development environment, a relational database is a mainstream enterprise application environments permanent storage of data of
the data storage
system. Object and relational data are
business entities
in two forms in the form of business entity performance object in memory, the performance of relational data in the database. An association and inheritance relationships between objects in memory, and in the database, relational data can not be directly expressed many to many associations and inheritance. Accordingly, the object - relational mapping (ORM) system generally
intermediate
form is present, the main procedures for the mapping of objects to the relational database.
Practical application
That is the practical application of relational databases and
business entities
between objects as a map, so that we operate in a specific
business object
time, you do not need to go and complex
SQL statements
deal, as long as the operation object operating as usual it it.
ORM framework is used to implement the program ORM technology.
Common ORM framework: Hibernate , TopLink , JDO Castor, the Apache OJB and so on.
ORM framework is used to implement the program ORM technology.
Common ORM framework: Hibernate , TopLink , JDO Castor, the Apache OJB and so on.
Java
in the ORM principle: Let me talk about realization of the principle of ORM, in fact, be achieved JavaBean property to map the fields of the database table, any ORM framework is nothing more than reading a profile of the field JavaBean properties, and database tables automatically associate, when from the database Query, automatically into the corresponding attribute value field in the JavaBean, as INSERT or UPDATE, automatically JavaBean property values bound to the SQL statement.
A simple example of mapping (
Hibernate
), we define the association between the User object and database user tables, user tables are only two: id and name:
<hibernate-mapping> <class name="sample.orm.hibernate.User" table="user" catalog="test"> <id name="userID" type="java.lang.Integer"> <column name="id" /> <generator class="assigned" /> </id> <property name="userName" type="java.lang.String"> <column name="name" /> </property> </class> </hibernate-mapping>
2、
2. Return to top |
3. Back to top |
4. Top |
5. Top |
1、
2、
6. Back to top |
Author: ylbtech Source: http://ylbtech.cnblogs.com/ This article belongs to the author and blog Park total, welcome to reprint, but without the author's consent declared by this section must be retained, and given the original connection in the apparent position of the article page, otherwise reserves the right to pursue legal responsibilities. |