You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both Storm and Exposed use a `transaction { }` block for programmatic transaction management, but they differ significantly in propagation support.
239
+
240
+
Exposed's native API supports two modes: shared nesting (the default, where inner blocks join the outer transaction) and savepoint-based nesting (via `useNestedTransactions = true`). For other propagation behaviors, Exposed relies on Spring's `@Transactional` through its `SpringTransactionManager` integration module.
241
+
242
+
Storm supports all seven standard propagation modes natively in its `transaction { }` block, without requiring Spring:
243
+
244
+
| Propagation | Storm | Exposed |
245
+
|-------------|-------|---------|
246
+
|`REQUIRED`| Yes | Yes (default behavior) |
247
+
|`REQUIRES_NEW`| Yes | No (Spring only) |
248
+
|`NESTED`| Yes | Yes (`useNestedTransactions`) |
249
+
|`MANDATORY`| Yes | No |
250
+
|`SUPPORTS`| Yes | No |
251
+
|`NOT_SUPPORTED`| Yes | No |
252
+
|`NEVER`| Yes | No |
253
+
254
+
This means Storm's programmatic API can express patterns like audit logging (`REQUIRES_NEW`), defensive boundary enforcement (`MANDATORY`, `NEVER`), and non-transactional operations (`NOT_SUPPORTED`) directly in code, while Exposed requires Spring integration for these use cases. See [Transactions](transactions.md) for details and examples of each propagation mode.
Copy file name to clipboardExpand all lines: docs/sql-templates.md
+14-18Lines changed: 14 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -341,40 +341,36 @@ When working with subqueries or nested template expressions, you may need to con
341
341
|`INNER`| Resolve only within the current (innermost) scope. Fails if the alias is not defined locally. |
342
342
|`OUTER`| Resolve only from outer scope(s), ignoring locally defined aliases. |
343
343
344
-
The `alias()` and `column()` template functions accept an optional `ResolveScope` parameter:
344
+
The `alias()` and `column()` template functions accept an optional `ResolveScope` parameter. This is most useful in correlated subqueries where the same entity appears in both the outer and inner query. For example, selecting all pets that have at least one visit:
The `column()` function with a metamodel reference resolves to the fully qualified column name (e.g., `v.pet_id` and `p.id`). `INNER` tells Storm to resolve `Visit_.pet` from the subquery, while `OUTER` resolves `Pet_.id` from the main query.
373
+
378
374
In most cases the default `CASCADE` scope is correct, because it ensures that each alias resolves to exactly one table. Use `INNER` or `OUTER` when writing correlated subqueries where you need to control whether a reference resolves to the inner query's tables or the outer query's tables.
Copy file name to clipboardExpand all lines: docs/transactions.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,8 @@ Storm works directly with JDBC transactions and supports both programmatic and d
14
14
15
15
Storm for Kotlin provides a fully programmatic transaction solution (following the style popularized by [Exposed](https://github.com/JetBrains/Exposed)) that is **completely coroutine-friendly**. It supports **all isolation levels and propagation modes** found in traditional transaction management systems. You can freely switch coroutine dispatchers within a transaction (offload CPU-bound work to `Dispatchers.Default` or IO work to `Dispatchers.IO`) and still remain in the **same active transaction**.
16
16
17
+
While Storm's `transaction { }` blocks look similar to Exposed's, Storm goes further by supporting all seven standard propagation modes (`REQUIRED`, `REQUIRES_NEW`, `NESTED`, `MANDATORY`, `SUPPORTS`, `NOT_SUPPORTED`, `NEVER`). Exposed's native transaction API only supports basic nesting (shared transaction) and savepoint-based nesting (`useNestedTransactions = true`), without the ability to suspend an outer transaction, enforce transactional context, or run non-transactionally. See [Storm vs Exposed](comparison.md#storm-vs-exposed) for a detailed comparison.
18
+
17
19
The API is designed around Kotlin's type system and coroutine model. Import the transaction functions and enums from `st.orm.template`:
0 commit comments