Skip to content
CAI
Software that uses CAICheck a score

mybatis/scala

64.0

Adequate · 20 September 2026

4.1k

lines of production code

Scala

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a Scala-native integration layer for MyBatis that provides a type-safe, idiomatic API for defining database configurations, SQL mappings, and session management without relying on XML. It enables developers to perform CRUD operations, handle complex result mappings with associations, and manage transactions using Scala 3 features like Option types and case classes. The project includes comprehensive examples and tests demonstrating these capabilities against an in-memory HSQLDB database.

How it got here

2011 — Scala 3 migration and API initialization

8 changes.

The project was initialized with Maven scaffolding and migrated from Scala 2 to Scala 3, updating core dependencies and build tooling. This period established a new Scala-native configuration, mapping, and session management API to replace XML-centric approaches, while updating sample code to demonstrate idiomatic Scala 3 features like Option types and the @main annotation.

2012 — Scala 3 sample migration and expansion

7 changes.

The project migrated existing delete, update, and select samples to Scala 3 syntax and semantics, adopting modern idioms like asterisk imports and compile-time initialization. New sample programs were added to demonstrate insert operations, complex result mappings with associations, and nested select queries. The period also included utility updates for database schema management and the addition of performance profiling tests using HSQLDB.

2014–2020 — Build infrastructure and test coverage

4 changes.

This period focused on standardizing the build environment by introducing the Maven Wrapper with strict security and integrity checks. It also involved significantly expanding test coverage for core components and establishing consistent code formatting and licensing standards across the project.

Features

Add Maven Wrapper for reproducible builds

The project now includes the Maven Wrapper (version 3.3.4) and is configured to use Apache Maven 3.9.16. This allows developers to build the project without manually installing Maven, as the wrapper script will automatically download the specified version. The configuration enforces integrity checks via SHA-256 sums for both the Maven distribution and the wrapper JAR.

.mvn/wrapper · high confidence

Add sample demonstrating complex result mapping with associations and collections

The resultmap sample directory now includes a new Scala 3 example, SelectWithResultMapSample.scala, which demonstrates how to map nested objects using MyBatis Scala's ResultMap. This sample defines a Person model containing a Group association and a ContactInfo collection, showing how to configure one-to-one and one-to-many relationships in the mapping definition and execute the corresponding SQL query.

mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/resultmap · high confidence

Added Nested Select sample for MyBatis Scala

A new example demonstrating nested select mappings has been added to the MyBatis Scala samples. The NestedSelectSample illustrates how to map a Person entity that includes an associated Group and a collection of ContactInfo records using nested select queries, providing a concrete reference for implementing complex object graphs with MyBatis Scala.

mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/nestedselect · high confidence

Introduces Scala session management with configurable executor and isolation levels

The session package now provides Scala-native wrappers for MyBatis lifecycle management. Users can manage transactions via \SessionManager\ methods (\readOnly\, \transaction\, \managed\) that accept specific \ExecutorType\ (SIMPLE, REUSE, BATCH) and \TransactionIsolationLevel\ (READ\_COMMITTED, SERIALIZABLE, etc.) parameters. The \Session\ class wraps \SqlSession\ to expose standard CRUD operations, while \ResultHandlerDelegator\ facilitates callback-based result handling.

mybatis-scala-core/src/main/scala/org/mybatis/scala/session · high confidence

Introduces pure Scala configuration API with cache and Option type support

The \mybatis-scala-core\ configuration package now provides a pure Scala builder for MyBatis settings, replacing or supplementing previous XML-centric approaches. Users can now configure caching directly via Scala code, with support for standard eviction policies (LRU, FIFO, SOFT, WEAK) and external cache references. The configuration also automatically registers type handlers for Scala \Option\[\_\]\ types across common JDBC types, allowing seamless handling of nullable values. Additionally, the \DefaultObjectFactory\ has been updated to support Scala collection types (Seq, Map, Set) as bean properties, and the \DynamicSQLBuilder\ enforces strict whitespace validation in \\<choose\>\ tags to prevent parsing errors.

mybatis-scala-core/src/main/scala/org/mybatis/scala/config · high confidence

New Scala mapping API for SQL statements and type handling

The \mybatis-scala-core/src/main/scala/org/mybatis/scala/mapping\ package now provides a complete set of Scala-native classes for defining and executing database operations. Users can now use \Select\, \Insert\, \Update\, and \Delete\ classes to map SQL statements, with support for parameterized queries, result caching, and row bounds. The package introduces \OptionTypeHandler\ and specific handlers (e.g., \OptIntegerTypeHandler\) to seamlessly map Scala \Option\[T\]\ types to JDBC columns, handling nulls correctly. Additionally, it includes wrappers for MyBatis core concepts like \JdbcType\, \StatementType\, \ResultSetType\, and \KeyGenerator\, along with \ResultMapping\ and \ResultFlag\ for detailed result set configuration. This change establishes the foundational mapping layer for the Scala integration, replacing or supplementing previous XML-based or less type-safe approaches.

mybatis-scala-core/src/main/scala/org/mybatis/scala/mapping · high confidence

New Scala-native configuration and mapping API

The repository introduces a new set of Scala-specific classes for configuring MyBatis and defining result mappings, including \Environment\, \RowBounds\, \ResultMap\, and \Binding\. These components provide a type-safe, idiomatic way to set up persistence contexts and map database results to Scala case classes (as demonstrated in the new \SelectImmutableSample\). The \Binding\ object adds compile-time checked inline parameter bindings, while \ResultMap\ supports constructor argument mapping and associations, enabling users to leverage Scala's features for data access without relying solely on XML configuration.

repository · high confidence

New insert samples for MyBatis-Scala using Scala 3 syntax

Added two new sample programs, InsertSample and InsertSampleBatch, demonstrating how to perform single and batch insert operations using MyBatis-Scala. These samples are written in Scala 3, utilizing the new wildcard import syntax (\*) and the scala.compiletime.uninitialized construct for field initialization, and they rely on an external mybatis.xml configuration file.

mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/insert · high confidence

New sample database schema and data utilities

Added DBSchema and DBSampleData utility objects to the samples package. DBSchema defines the SQL statements to create the people\_group, person, and contact\_info tables, while DBSampleData provides methods to populate these tables with sample records using MyBatis Scala insert mappings.

mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/util · high confidence

Project initialization with Maven wrapper and standard configuration files

The repository has been initialized with essential project scaffolding, including the Apache Maven Wrapper (version 3.3.4) for consistent builds, a comprehensive .gitignore file to exclude build artifacts and IDE settings, and standard legal files (LICENSE, NOTICE, LICENSE\_HEADER). Additionally, a README.md has been added to document the project, and a renovate.json configuration is in place to automate dependency updates.

(repo-wide) · high confidence

Behavioural changes

Add Scala 3 select sample with bind tag support and HSQLDB

The select sample has been updated to use Scala 3 syntax, including wildcard imports (\*) and compiletime.uninitialized for fields. It now demonstrates the \<bind\> tag in dynamic SQL and uses HSQLDB as the database instead of PostgreSQL.

mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/select · high confidence

Maven wrapper configuration updated with profiler and security settings

The Maven wrapper configuration has been updated to include the maven-profiler extension (version 3.3) via a new extensions.xml file, enforce stronger checksum algorithms (SHA-512, SHA-256, SHA-1, MD5) in maven.config, and define server credentials for central deployment, GitHub pages, and NVD API access in settings.xml.

.mvn · high confidence

Migrate delete and update samples to Scala 3 syntax and semantics

The delete and update sample applications have been rewritten to use Scala 3. This includes migrating wildcard imports from the Scala 2 underscore (\) to the Scala 3 asterisk (\), replacing Scala 2 uninitialized field wildcards with the \scala.compiletime.uninitialized\ construct, and enforcing type-safe signatures for mapped statements. These changes ensure the samples are compatible with the Scala 3 compiler and follow modern Scala idioms.

mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/delete, mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/update · high confidence

Migrate sample resources to HSQLDB

The sample configuration and database scripts in \mybatis-scala-samples/src/main/resources\ have been updated to use HSQLDB instead of PostgreSQL. The \mybatis.xml\ configuration now points to an in-memory HSQLDB instance (\jdbc:hsqldb:mem:scala\) using the \org.hsqldb.jdbcDriver\, and the \schema.sql\ and \sample-data.sql\ files have been replaced with HSQLDB-compatible table definitions and data inserts, allowing the samples to run without a PostgreSQL dependency.

mybatis-scala-samples/src/main/resources · high confidence

Migrated CRUD samples to Scala 3 and Option-based types

The CRUD sample code has been updated to Scala 3, replacing Scala 2 syntax such as the \extends App\ trait with the \@main\ annotation and wildcard imports with the new \\*\ syntax. The \Item\ model now uses \Option\ types for nullable fields (\info\ and \year\), and the \ItemDAO\ has been adjusted to handle these types, including the use of \scala.compiletime.uninitialized\ for field initialization. Additionally, the \SelectOne\ query signature now returns \Option\[R\]\ to reflect potential absence of results, and the sample application demonstrates these changes by inserting and querying items with optional attributes.

mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/crud · high confidence

Test coverage

Added performance profiling test for MyBatis Scala samples; Expanded test coverage for core MyBatis-Scala components.

Dependencies

Migrate to Scala 3 and update core dependencies

The project has been migrated from Scala 2 to Scala 3 (version 3.9.0), introducing new Scala 3-specific artifacts (e.g., \scala3-library\_3\, \scala-xml\_3\) and updating the parent POM to \mybatis-scala-parent\_3\. The core module now depends on MyBatis 3.5.19 and ScalaTest 3.2.20, while the samples module uses HSQLDB 2.7.4. Build tooling includes \scala-maven-plugin\ 4.9.10 and \scalatest-maven-plugin\ 2.2.0, with specific configurations to suppress the legacy \-doc-title\ option that breaks Scala 3 scaladoc generation.

(dependencies) · high confidence

Housekeeping

Added license headers and code formatting configuration

The mybatis-scala-core and mybatis-scala-samples modules now include LICENSE\_HEADER files containing the Apache License 2.0 text and format.xml files to support automated code formatting. These additions standardize legal attribution and code style enforcement across the project.

mybatis-scala-core, mybatis-scala-samples · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 64.

Lenses

  • Code Health 95
  • Architecture 88
  • Maturity 47
  • Readiness 66
  • Security 100

Changes since last survey

  • 300 commits — 293 feature/other, 7 fixes

By area

  • (repo) — 132 commits
  • .github/workflows — 64 commits
  • (root) — 53 commits
  • mybatis-scala-core/src — 23 commits
  • .mvn/wrapper — 11 commits
  • mybatis-scala-core/pom.xml — 10 commits
  • mybatis-scala-samples/src — 3 commits
  • .mvn/settings.xml — 2 commits
  • .mvn/extensions.xml — 1 commit
  • mybatis-scala-samples/pom.xml — 1 commit

Notable commits

  • fix: Fix DynamicSQLBuilder.scala syntax error: remove extra closing brace in parse method
  • fix: Fix Scala 3 scaladoc: suppress legacy -doc-title option that breaks scala3doc
  • fix: Fix choose element to only accept XML whitespace, throw error for other content
  • fix: Merge pull request #261 from mybatis/copilot/fix-xml-whitespace-restriction
  • fix: [GHA] Fix codeql
  • fix: [gha] Fix site action location
  • fix: [pom] Fix head tag
  • change: Add Scala 3.8 support to README
  • change: Add coverage tests for config, session, and utility wrappers
  • change: Correct Scala 3.8 badge link in README
  • change: Create codeql.yml
  • change: Expand coverage with configuration builder and result map tests
  • change: Increase code coverage: add Delete/Update tests, expand DynamicSQLBuilderSpec, add BindingSpec
  • change: Initial plan
  • change: Initial plan
  • change: Merge branch 'master' into copilot/improve-test-coverage
  • change: Merge master (deb808b) into Scala 3 branch: resolve DynamicSQLBuilder conflict
  • change: Merge pull request #182 from mybatis/renovate/org.mybatis-mybatis-parent-42.x
  • change: Merge pull request #183 from mybatis/renovate/org.scalatest-scalatest_2.13-3.x
  • change: Merge pull request #184 from hazendaz/master
  • …and 280 more

Architecture

  • 0 containers · 1 bounded contexts · 0 dependency edges (baseline)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

mybatis/scala was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit d78bbfec7dfb0743fd6cd409897941b38f661240 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.