Code Explainers
Code explainers tagged #transactions
java
@Service public class OrderCheckoutService { private final OrderRepository orderRepository;
How @Transactional guards a Spring checkout
dependency-injection
transactions
atomicity
Intermediate
6 steps
java
package com.example.maintenance; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
How a scheduled cleanup job runs in Spring
scheduling
cron
transactions
Intermediate
6 steps
java
@Service public class ProductCatalogService { private final ProductRepository productRepository;
How Spring cache annotations keep data fresh
caching
cache-invalidation
dependency-injection
Intermediate
7 steps
java
@Service public class OrderService { private final OrderRepository orderRepository;
Decoupling side effects with Spring events
event-driven
transactions
decoupling
Intermediate
8 steps
java
@Entity @Table(name = "accounts") public class Account {
Optimistic locking with @Version in Spring
optimistic-locking
jpa
concurrency
Advanced
7 steps
ruby
class PaymentsController < ApplicationController before_action :require_idempotency_key def create
Idempotent payment creation in Rails
idempotency
transactions
race-conditions
Advanced
10 steps
java
@Repository public interface OrderRepository extends JpaRepository<Order, Long> { @QueryHints(@QueryHint(name = HINT_FETCH_SIZE, value = "1000"))
Streaming large result sets in Spring Data JPA
streaming
jpa
memory-management
Advanced
6 steps
ruby
class CheckoutService Result = Struct.new(:success?, :order, :error, keyword_init: true) def self.call(...)
How a Rails checkout service object works
service object
transactions
result object
Intermediate
9 steps
ruby
class RegistrationForm include ActiveModel::Model include ActiveModel::Attributes
How a Rails form object spans two models
form object
validations
transactions
Intermediate
7 steps
ruby
module FileResource # Opens a file, yields it to the caller, and guarantees the # handle is closed even if the block raises an exception. def self.open(path, mode = "r")
Guaranteeing cleanup with begin/ensure in Ruby
resource-management
exception-safety
blocks
Intermediate
8 steps