main

DAO Oriented Database Mapping Framework for Java 8+

License

License

Categories

Categories

Doma Data ORM
GroupId

GroupId

org.seasar.doma
ArtifactId

ArtifactId

doma
Last Version

Last Version

2.30.0-beta-1
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

main
DAO Oriented Database Mapping Framework for Java 8+
Project URL

Project URL

https://github.com/domaframework/doma
Source Code Management

Source Code Management

https://github.com/domaframework/doma

Download doma

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Doma

Doma 2 is a database access framework for Java 8+. Doma has various strengths:

  • Verifies and generates source code at compile time using annotation processing.
  • Provides type-safe Criteria API.
  • Supports Kotlin.
  • Uses SQL templates, called "two-way SQL".
  • Has no dependence on other libraries.

Build Status docs javadoc project chat Twitter

Examples

Type-safe Criteria API

Written in Java 8:

Entityql entityql = new Entityql(config);
Employee_ e = new Employee_();
Department_ d = new Department_();

List<Employee> list = entityql
    .from(e)
    .innerJoin(d, on -> on.eq(e.departmentId, d.departmentId))
    .where(c -> c.eq(d.departmentName, "SALES"))
    .associate(e, d, (employee, department) -> {
        employee.setDepartment(department);
        department.getEmployeeList().add(employee);
    })
    .fetch();

Written in Kotlin:

val entityql = KEntityql(config)
val e = Employee_()
val d = Department_()

val list = entityql
    .from(e)
    .innerJoin(d) { eq(e.departmentId, d.departmentId) }
    .where { eq(d.departmentName, "SALES") }
    .associate(e, d) { employee, department ->
        employee.department = department
        department.employeeList += employee
    }
    .fetch()

See Criteria API for more information.

SQL templates

Written in Java 15:

@Dao
public interface EmployeeDao {

  @Sql(
    """
    select * from EMPLOYEE where
    /*%if salary != null*/
      SALARY >= /*salary*/9999
    /*%end*/
    """)
  @Select
  List<Employee> selectBySalary(BigDecimal salary);
}

See SQL templates for more information.

More Examples

Try Getting started.

For more complete examples, see simple-examples and spring-boot-jpetstore.

Installing

Gradle

For Java projects:

dependencies {
    implementation("org.seasar.doma:doma-core:2.46.0")
    annotationProcessor("org.seasar.doma:doma-processor:2.46.0")
}

For Kotlin projects, use doma-kotlin instead of doma-core and use kapt in place of annotationProcessor:

dependencies {
    implementation("org.seasar.doma:doma-kotlin:2.46.0")
    kapt("org.seasar.doma:doma-processor:2.46.0")
}

Maven

We recommend using Gradle, but if you want to use Maven, see below.

For Java projects:

...
<properties>
    <doma.version>2.46.0</doma.version>
</properties>
...
<dependencies>
    <dependency>
        <groupId>org.seasar.doma</groupId>
        <artifactId>doma-core</artifactId>
        <version>${doma.version}</version>
    </dependency>
</dependencies>
...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source> <!-- depending on your project -->
                <target>1.8</target> <!-- depending on your project -->
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.seasar.doma</groupId>
                        <artifactId>doma-processor</artifactId>
                        <version>${doma.version}</version>
                    </path>
                </annotationProcessorPaths>
            </configuration>
        </plugin>
    </plugins>
</build>

For Kotlin projects, see Kotlin document.

Documentation

https://doma.readthedocs.io/

Forum

https://groups.google.com/g/doma-user

Chatroom

https://domaframework.zulipchat.com

Related projects

Major versions

Status and Repository

Version Status Repository Branch
Doma 1 stable https://github.com/seasarorg/doma/ master
Doma 2 stable https://github.com/domaframework/doma/ master

Compatibility matrix

Doma 1 Doma 2
Java 6 v
Java 7 v
Java 8 v v
Java 9 v
Java 10 v
Java 11 v
Java 12 v
Java 13 v
Java 14 v
Java 15 v
Java 16 v
org.seasar.doma

domaframework

Database mapping framework and related projects for Java

Versions

Version
2.30.0-beta-1
2.29.0
2.28.0
2.27.1
2.27.0
2.26.0
2.25.1
2.25.0
2.24.0
2.23.0
2.22.0
2.21.0
2.20.0
2.19.3
2.19.2
2.19.1
2.19.0
2.18.0
2.17.0
2.16.1
2.16.0
2.15.0
2.14.0
2.13.0
2.12.1
2.12.0
2.11.0
2.10.0
2.9.0
2.8.0
2.7.0
2.6.2
2.6.1
2.6.0
2.5.1
2.5.0
2.4.1
2.4.0
2.3.1
2.3.0
2.2.0
2.1.0
2.0.1
2.0.0
2.0-beta-5
2.0-beta-4
2.0-beta-3
2.0-beta-2
2.0-beta-1
1.38.2
1.38.1
1.38.0