Skip to content

DAO oriented database mapping framework for Java 8+

License

Notifications You must be signed in to change notification settings

lusingander/doma

 
 

Repository files navigation

Doma Build Status Maven Central

Join the chat at https://gitter.im/domaframework/doma

Doma is a database access framework for Java. Doma uses Pluggable Annotation Processing API to generate source code and validate sql mappings at compile time.

Example

Define an entity class:

@Entity
public class Employee {
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @SequenceGenerator(sequence = "EMPLOYEE_SEQ")
    public Integer id;
    public String name;
    public Integer age;
    @Version
    public Integer version;
}

Define a DAO interface:

@Dao(config = AppConfig.class)
public interface EmployeeDao {
    @Select
    Employee selectById(Integer id);
    @Update
    int update(Employee employee);
}

Execute queries:

public class App {
    public static void main(String[] args) {
        TransactionManager tm = AppConfig.singleton().getTransactionManager();
        tm.required(() -> {
            EmployeeDao dao = new EmployeeDaoImpl();
            Employee employee = dao.selectById(1);
            employee.age++;
            dao.update(employee);
        });
    }
}

Documentation

https://doma.readthedocs.io/

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

License

Copyright 2019 domaframework.org

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

DAO oriented database mapping framework for Java 8+

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%