News for hackers. Stuff that matters.
Re:Is ORM still an anti-pattern? by c00lio on Tuesday June 27, 2023 @04:41PM (#36498346)
Also, most ORMs make it hard or ignore the possibility of using database transactions, checkpoints, partial or full rollbacks, etc. Which might be fine for trivial queries, low write load and unimportant data. But for anything moderately important or complex, transactions are essential.
Re:Is ORM still an anti-pattern? by antonyt on Tuesday June 27, 2023 @04:51PM (#36498460)
They do? Every ORM I've used supports explicit transactions and rollbacks. EF, NHibernate, GORM, SQLAlchemy. What major ORMs deny you this functionality?
Re:Is ORM still an anti-pattern? by ttfkam on Tuesday June 27, 2023 @06:32PM (#36499596)
Yep, and each has their own bespoke and often inconsistent API. All to eventually emit plain ole BEGIN/COMMIT/ROLLBACK.

JPA is at least a spec rather than just yet another single isolated implementation. Unfortunately it's not a good spec.

Re:Is ORM still an anti-pattern? by c00lio on Wednesday June 28, 2023 @04:54AM (#36503991)
It isn't that there is no such thing as "a way to open/close transactions". It is that transactions usually break all the supposed ORM benefits like composability. Often, you cannot even method-chain transactions like foo.search().begin().insert().insert().commit(), you have to do it in multiple lines. Even worse, rollback handling is often an exception, breaking control flow of your application.

And most only support basic transactions, not checkpoints.

Re:Is ORM still an anti-pattern? by mathewpregasen on Tuesday June 27, 2023 @06:18PM (#36499460)
I think most ORMs support transactions at this stage!