In practice there are two common ORM patterns:
- ActiveRecord: uses the model class to handle both business logic and database access.
- DataMapper: a more complex approach which separates the in-memory objects from the database. Uses two class types:
- Mapper: handles database access and mapping entities
- Entities: in-memory representation with business logic
Some ORMs, like TypeORM support both patterns. Others like Sequelize support only ActiveRecord.