Skip to main content

Posts

Showing posts with the label Java

Where to Place @Transactional in Hexagonal Architecture: Use Cases vs Adapters

  Migrating to Hexagonal Architecture (Ports and Adapters) promises decoupled code and domain-centric design. However, it introduces a specific friction point for Spring Boot developers:   Transaction Management. In a traditional Layered Architecture, placing  @Transactional  on the Service layer is muscle memory. In Hexagonal, the "Service" is split into Use Cases, Input Ports, and Application Services. If you misplace the transaction boundary, you face two critical failures: the dreaded  LazyInitializationException  during DTO mapping, or worse, data corruption due to partial commits when a business operation spans multiple driven adapters. This guide defines strictly where  @Transactional  belongs in a robust Hexagonal setup, why it belongs there, and how to implement it using Java 21 and Spring Boot 3. The Root Cause: Why Boundaries Break To understand where to put the annotation, we must understand what Spring and Hibernate are doing under th...

Fixing 'Unsupported Class File Major Version' & Gradle 8 Compatibility in Flutter

  You have just upgraded Flutter, Android Studio, or your JDK, and your build pipeline has halted with a stack trace resembling this: java.lang.IllegalArgumentException: Unsupported class file major version 61 Or perhaps version  65 . This is not a cryptic bytecode error; it is a rigid version mismatch. In the Java ecosystem, class file major versions correspond to specific JDK releases: 61  = Java 17 65  = Java 21 This error occurs when a build tool (specifically Gradle) running on an older JVM attempts to read classes compiled by a newer JDK, or when the Gradle version defined in your project is too old to support the JDK version you are forcing it to run on. With the release of Android Gradle Plugin (AGP) 8.0, the Android ecosystem has enforced a hard floor of  JDK 17 . If your Flutter project’s Gradle wrapper or AGP version is outdated, the build fails immediately. Here is the root cause analysis and the definitive, step-by-step upgrade path to resolve this ...