Active record pattern: Difference between revisions

Content deleted Content added
m Reference no longer exists. Results in a snippet if not logged into host website but 404 if logged in.
Tag: references removed
Line 3:
The active record pattern is an approach to accessing data in a [[database]]. A [[database table]] or [[View (database)|view]] is wrapped into a [[class (computer science)|class]]. Thus, an [[object (computer science)|object]] instance is tied to a single row in the table. After creation of an object, a new row is added to the table upon save. Any object loaded gets its information from the database. When an object is updated, the corresponding row in the table is also updated. The wrapper class implements [[accessor]] [[Method (computer programming)|methods]] or properties for each column in the table or view.
 
This pattern is commonly used by object persistence tools and in [[object-relationalobject–relational mapping]] (ORM). Typically, [[foreign key]] relationships will be exposed as an object instance of the appropriate type via a property.
 
== Implementations ==