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

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.

主站蜘蛛池模板: 汝城县| 庄河市| 抚顺市| 亳州市| 蓬溪县| 巴里| 新和县| 西充县| 金阳县| 延安市| 台湾省| 正定县| 河东区| 贡山| 叶城县| 麟游县| 澄迈县| 宁远县| 金平| 晋宁县| 南溪县| 鄄城县| 新安县| 顺昌县| 蒙阴县| 苗栗县| 达州市| 金山区| 比如县| 习水县| 云安县| 鹤峰县| 东辽县| 大同县| 苍梧县| 罗城| 噶尔县| 长子县| 新安县| 吐鲁番市| 会同县|