Joist

Joist is a simple, productive Java ORM with no boilerplate, type-safe queries, and no runtime class generation.

How it Works

You write migrations to modify your schema:

    public class m0002 extends AbstractMigration {
      public m0002() {
        super("Add employee table.");
      }

      public void apply() {
        createTable("employee",
          primaryId("id"),
          varchar("name"),
          varchar("email").nullable(),
          integer("version"));
      }
    }

Run cycle to update your database and get clean, getter/setter-free domain objects:

    public class Employee extends EmployeeCodegen {
      // put your business logic here, it won't get over written

      // getters/setters/collections are in the base class
    }

Now you can write type-safe queries:

    public class EmployeeQueries {
      public List<Employee> findByName(String name) {
        EmployeeAlias e = new EmployeeAlias("e");
        return Select.from(e).where(e.name.eq(name)).list();
      }
    }

The goal is a simple, “it just works” domain layer for enterprise-scale schemas.

To jump in, see getting started.

Screencast

 

Why Joist is Awesome

Implementation Details:

Blog posts:

Opinions

Joist is tailored for projects that agree with its opinions:

Community

Acknowledgements

Joist borrows ideas mainly from Rails (migrations and database-reflected-domain objects) and JaQu (type-safe SQL queries).