官术网_书友最值得收藏!

What is ORM?

ORM stands for Object-Relational Mapping. ORM libraries map database tables to classes, rows of those tables to objects of the class, and columns to object attributes. Object wraps a row of a database table or view, encapsulates the database access, and adds domain logic on that data.

ORM connects business objects and database tables to create a domain model where logic and data are presented in one wrapping.

In addition, the ORM classes wrap our database tables to provide a set of class-level methods that perform table-level operations. For example, we might need to find the Employee with a particular ID. This is implemented as a class method that returns the corresponding Employee object. In Ruby code, this will look like:

employee= Employee.find(1)

This code will return an employee object whose ID is 1.

主站蜘蛛池模板: 工布江达县| 阆中市| 新营市| 醴陵市| 凌海市| 扬州市| 肃宁县| 平谷区| 临泽县| 汉寿县| 宜兴市| 南投市| 醴陵市| 南宫市| 百色市| 额济纳旗| 三亚市| 东平县| 深泽县| 将乐县| 潮安县| 醴陵市| 子洲县| 罗城| 都昌县| 揭西县| 雅安市| 洛川县| 综艺| 公主岭市| 石渠县| 广西| 陇西县| 长子县| 和林格尔县| 南陵县| 平阴县| 共和县| 北川| 遂宁市| 都安|