All tags / #orm

#orm

3 posts

Calculated Properties: SQL-Defined Values Without the N+1 (or the Bloat)

Peter Amiri

Declare fullName or commentCount once as SQL on the model and it behaves like a column everywhere — sortable, selectable, never stale. And Wheels 4's select=false + includeCalculated pair fixes the cost problem calculated properties always created: expensive expressions run only where they're asked for, additively.

Processing 400,000 Rows Without Melting the JVM: findEach and findInBatches

Peter Amiri

findAll on 400,000 rows materializes everything into memory at once — and the request cache holds it there. Wheels 4's findEach and findInBatches walk big result sets a page at a time, with three built-in optimizations you'd forget to hand-roll and two sharp edges worth knowing first.

Associations Deep-Dive: hasMany, belongsTo, Nested Properties, and Eager Loading

Peter Amiri

A comprehensive Wheels 4.0 guide to model associations — hasMany, belongsTo, and hasOne, the exact dynamic methods each one generates, dependent-delete cascades, nested properties from form params, eager loading with include=, has-many-through, and polymorphic associations — with the sharp edges that bite in practice.

Newsletter

Release notes and new posts, once a month. No spam.

Prefer RSS? Subscribe to the feed →