logoalt Hacker News

robertlagrant05/15/20252 repliesview on HN

For all the Prisma-haters: I salute you. But I want to reply to numerous comments with the following:

ORMs come in two main types, that I'm aware of: Active Record (named after the original Ruby one, I think) and Data Mapper (think Hibernate; SQLAlchemy).

Active Record ORMs are slightly more ergonomic at the cost of doing loads of work in application memory. Data Mapper looks slightly more like SQL in your code but are much more direct wrappers over things you can do in SQL.

Data Mapper also lets you keep various niceties such as generating migration code, that stem from having your table definition as objects.

Use Data Mapper ORMs if you want to use an ORM.


Replies

arunix05/15/2025

Also, the Query Object style, e.g. JOOQ and SQLAlchemy Core

https://martinfowler.com/eaaCatalog/queryObject.html

felipemesquita05/15/2025

Rails’ Active Record was named after the pattern as described by Martin Fowler:

https://www.martinfowler.com/eaaCatalog/activeRecord.html

show 1 reply