Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ jobs:
run: npx docusaurus docs:version ${{ steps.version.outputs.VERSION }}
working-directory: website

- name: Update default version in config
run: |
sed -i "s/lastVersion: '.*'/lastVersion: '${{ steps.version.outputs.VERSION }}'/" docusaurus.config.ts
working-directory: website

- name: Commit and push
run: |
git config user.name "github-actions[bot]"
Expand Down
1 change: 0 additions & 1 deletion website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const config: Config = {
path: '../docs',
routeBasePath: '/',
sidebarPath: './sidebars.ts',
lastVersion: '1.9.0',
versions: {
current: {
label: 'Next',
Expand Down
97 changes: 97 additions & 0 deletions website/versioned_docs/version-1.9.0/api-java.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: Java API Reference
---

# Java API Reference

Storm's Java API is organized into a set of focused modules. Each module has a specific role, from the core ORM engine to Spring Boot auto-configuration. This page provides an overview of the module structure and links to detailed documentation for each concept.

## Module Overview

### storm-java21

The main Java API module. It provides the `ORMTemplate` entry point, repository interfaces, SQL Templates using Java's String Templates (preview feature), and the type-safe query DSL. This is the primary dependency for Java applications.

```xml
<dependency>
<groupId>st.orm</groupId>
<artifactId>storm-java21</artifactId>
<version>1.9.1</version>
</dependency>
```

**String Templates (Preview Feature):** The Java API uses JDK String Templates for SQL construction. String Templates are a preview feature in Java 21+, which means you must compile with `--enable-preview` and run with `--enable-preview`. The preview status means the syntax may change in future JDK releases, and Storm's Java API surface will adapt accordingly. The Kotlin API does not depend on any preview features and is fully stable.

To enable preview features in Maven:

```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</plugin>
```

### storm-spring

Spring Framework integration for Java. Provides `RepositoryBeanFactoryPostProcessor` for repository auto-discovery and injection, plus transaction integration. Add this module when you use Spring Framework without Spring Boot.

```xml
<dependency>
<groupId>st.orm</groupId>
<artifactId>storm-spring</artifactId>
<version>1.9.1</version>
</dependency>
```

See [Spring Integration](spring-integration.md) for configuration details.

### storm-spring-boot-starter

Spring Boot auto-configuration for Java. Automatically creates an `ORMTemplate` bean from the `DataSource`, discovers repositories, and binds `storm.*` properties from `application.yml`. This is the recommended dependency for Spring Boot applications.

```xml
<dependency>
<groupId>st.orm</groupId>
<artifactId>storm-spring-boot-starter</artifactId>
<version>1.9.1</version>
</dependency>
```

See [Spring Integration: Spring Boot Starter](spring-integration.md#spring-boot-starter) for what the starter provides and how to override its defaults.

## Key Classes

| Class | Description | Guide |
|-------|-------------|-------|
| `ORMTemplate` | The central entry point. Create with `ORMTemplate.of(dataSource)`. Provides access to entity/projection repositories and the SQL template query engine. | [Getting Started](getting-started.md) |
| `EntityRepository<E, ID>` | Type-safe repository interface for CRUD operations on entities. Extend this interface and add custom query methods with default method bodies. | [Repositories](repositories.md) |
| `ProjectionRepository<P, ID>` | Read-only repository for projections (subset of entity columns). | [Projections](projections.md) |
| `Entity<ID>` | Marker interface for entity records. Implement this on your Java records to enable repository operations. | [Entities](entities.md) |
| `Projection<ID>` | Marker interface for projection records. | [Projections](projections.md) |
| `StormConfig` | Immutable configuration holder. Pass to `ORMTemplate.of()` to override defaults. | [Configuration](configuration.md) |

## Metamodel Generation

The `storm-metamodel-processor` annotation processor generates type-safe metamodel classes (e.g., `User_`) at compile time. These classes provide static references to entity fields for use in the query DSL, enabling compile-time checked queries.

```xml
<dependency>
<groupId>st.orm</groupId>
<artifactId>storm-metamodel-processor</artifactId>
<version>1.9.1</version>
<scope>provided</scope>
</dependency>
```

See [Metamodel](metamodel.md) for setup and usage.

## Javadoc

The aggregated Javadoc covers all Java modules in the Storm framework:

[Browse the Javadoc](../api/java/index.html)
148 changes: 148 additions & 0 deletions website/versioned_docs/version-1.9.0/api-kotlin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
title: Kotlin API Reference
---

# Kotlin API Reference

Storm's Kotlin API is organized into a set of focused modules. Each module has a specific role, from the core ORM engine with coroutine support to Spring Boot auto-configuration and validation. This page provides an overview of the module structure and links to detailed documentation for each concept.

## Module Overview

### storm-kotlin

The main Kotlin API module. It provides the `ORMTemplate` interface, extension functions (`DataSource.orm`, `Connection.orm`), repository interfaces, coroutine support, and the type-safe query DSL. This is the primary dependency for Kotlin applications.

```kotlin
// Gradle (Kotlin DSL)
implementation("st.orm:storm-kotlin:1.9.1")
```

```xml
<!-- Maven -->
<dependency>
<groupId>st.orm</groupId>
<artifactId>storm-kotlin</artifactId>
<version>1.9.1</version>
</dependency>
```

The Kotlin API does not depend on any preview features. All APIs are stable and production-ready.

### storm-kotlin-spring

Spring Framework integration for Kotlin. Provides `RepositoryBeanFactoryPostProcessor` for repository auto-discovery and injection, `@EnableTransactionIntegration` for bridging Storm's programmatic transactions with Spring's `@Transactional`, and transaction-aware coroutine support. Add this module when you use Spring Framework without Spring Boot.

```kotlin
implementation("st.orm:storm-kotlin-spring:1.9.1")
```

See [Spring Integration](spring-integration.md) for configuration details.

### storm-kotlin-spring-boot-starter

Spring Boot auto-configuration for Kotlin. Automatically creates an `ORMTemplate` bean from the `DataSource`, discovers repositories, enables transaction integration, and binds `storm.*` properties from `application.yml`. This is the recommended dependency for Spring Boot applications.

```kotlin
implementation("st.orm:storm-kotlin-spring-boot-starter:1.9.1")
```

See [Spring Integration: Spring Boot Starter](spring-integration.md#spring-boot-starter) for what the starter provides and how to override its defaults.

### storm-kotlin-validator

Validation support for Kotlin entities. Provides integration with Kotlin validation libraries for entity constraint checking.

```kotlin
implementation("st.orm:storm-kotlin-validator:1.9.1")
```

## Key Classes and Functions

| Class/Function | Description | Guide |
|----------------|-------------|-------|
| `ORMTemplate` | The central entry point. Create with `dataSource.orm` or `ORMTemplate.of(dataSource)`. Provides access to entity/projection repositories and the SQL template query engine. | [Getting Started](getting-started.md) |
| `EntityRepository<E, ID>` | Type-safe repository interface for CRUD operations on entities. Extend this interface and add custom query methods with default method bodies. | [Repositories](repositories.md) |
| `ProjectionRepository<P, ID>` | Read-only repository for projections (subset of entity columns). | [Projections](projections.md) |
| `Entity<ID>` | Marker interface for entity data classes. Implement this on your Kotlin data classes to enable repository operations. | [Entities](entities.md) |
| `Projection<ID>` | Marker interface for projection data classes. | [Projections](projections.md) |
| `DataSource.orm` | Extension property that creates an `ORMTemplate` from a `DataSource`. | [Getting Started](getting-started.md) |
| `transaction { }` | Coroutine-aware programmatic transaction block. | [Transactions](transactions.md) |
| `transactionBlocking { }` | Blocking variant of the programmatic transaction block. | [Transactions](transactions.md) |
| `StormConfig` | Immutable configuration holder. Pass to `dataSource.orm(config)` to override defaults. | [Configuration](configuration.md) |

## Coroutine Support

Storm's Kotlin API provides first-class coroutine support. Query results can be consumed as `Flow<T>` for streaming, and the `transaction { }` block is a suspending function that integrates with structured concurrency. Storm leverages JVM virtual threads under the hood, so database operations do not block platform threads even when using JDBC (which is inherently synchronous).

```kotlin
// Streaming with Flow
val users: Flow<User> = orm.entity(User::class).selectAll()
users.collect { processUser(it) }

// Suspending transaction
transaction {
orm insert User(name = "Alice")
}
```

## Metamodel Generation

The metamodel generates type-safe companion classes (e.g., `User_`) at compile time. These classes provide static references to entity fields for use in the query DSL, enabling compile-time checked queries.

There are two ways to configure metamodel generation for Kotlin projects, depending on your build tool:

- **Gradle with KSP:** Use `storm-metamodel-ksp`, which is a Kotlin Symbol Processing plugin.
- **Maven with kapt:** Use `storm-metamodel-processor`, which is a standard Java annotation processor invoked through kapt.

Both generate the same metamodel classes; they are different build tool integrations.

**Gradle (Kotlin DSL) with KSP:**

```kotlin
plugins {
id("com.google.devtools.ksp") version "2.0.21-1.0.28"
}

dependencies {
ksp("st.orm:storm-metamodel-ksp:1.9.1")
}
```

**Maven with kapt:**

```xml
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<executions>
<execution>
<id>kapt</id>
<goals><goal>kapt</goal></goals>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>st.orm</groupId>
<artifactId>storm-metamodel-processor</artifactId>
<version>1.9.1</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
</executions>
</plugin>
```

See [Metamodel](metamodel.md) for setup and usage.

## KDoc

KDoc is generated per module using Dokka. Select a module below to browse its API documentation.

| Module | Description |
|--------|-------------|
| [storm-kotlin](../api/kotlin/storm-kotlin/index.html) | Kotlin API with coroutine support |
| [storm-kotlin-spring](../api/kotlin/storm-kotlin-spring/index.html) | Spring Framework integration for Kotlin |
| [storm-kotlin-spring-boot-starter](../api/kotlin/storm-kotlin-spring-boot-starter/index.html) | Spring Boot auto-configuration for Kotlin |
| [storm-kotlin-validator](../api/kotlin/storm-kotlin-validator/index.html) | Kotlin validation support |
| [storm-metamodel-ksp](../api/kotlin/storm-metamodel-ksp/index.html) | Kotlin Symbol Processing for metamodel generation |
| [storm-kotlinx-serialization](../api/kotlin/storm-kotlinx-serialization/index.html) | Kotlinx Serialization support |
Loading