Developers

Write Database Applications While Remaining in a Pure Java World

Speedment is a Java Stream ORM toolkit and runtime. The toolkit analyzes the metadata of an existing SQL database and automatically creates a Java representation of the data model. This powerful ORM enables you to create scalable and efficient Java applications using standard Java Streams with no need to type SQL or use any new API.

Speedment was originally developed by researchers and engineers based in Palo Alto with the purpose to simplify and streamline the development of Java database applications by leveraging the Java Stream API.

SQL
JAVA STREAM
FROM stream()
COUNT count()
LIMIT limit()
SELECT map()
WHERE filter() (before collecting)
HAVING filter() (after collecting)
JOIN flatmap()
UNION concat(s0, s1).distinct()
ORDER BY sorted()
OFFSET skip()
GROUP BY collect(groupingBY())

Queries Expressed as Standard Java Streams

Speedment leverages the Stream API to enable database querying using lamdas without a single line of SQL. A custom delegator is used to optimize the resulting SQL queries for reduced database load, latency, and network load. The examples below illustrate the expressiveness of the stream queries.


FilmApplication app = new FilmApplicationBuilder()
    .withPassword("...") // Needs to match the database
    .build();

// FilmManager represents a table with films and is generated automatically
FilmManager films = app.getOrThrow(FilmManager.class);
      
NEW APPLICATION
Setting up a Speedment application requires only a few lines of code. For the sake of this simple demo, an open film database provided by MySQL is used. At this point, we are ready to query.

// Searches are optimized in the background!
Optional<Film> longFilm = films.stream()
    .filter(Film.LENGTH.greaterThan(120))
    .findAny();
      
BASE CASE
Let’s find a film with a length greater than 120 minutes. Such a query only requires a simple filter.

Join<Tuple2<Film, Language>> join = joinComponent
    .from(FilmManager.IDENTIFIER)
    .innerJoinOn(Language.LANGUAGE_ID).equal(Film.LANGUAGE_ID)
    .build(Tuples::of);
      
JAVA JOINS
Interested in knowing what language is spoken? A join will take care of that in a second.

Powerful Code Generator

Speedment analyses the underlying data sources’ metadata and automatically creates code which directly reflects the structure (i.e. the “domain model”) of the underlying data sources.

The graphical interface allows custom configurations and optimizations in a jiffy.

Watch a demo

Use any Database

Enjoy Full Type-Safety

JAVA GOT YOUR BACK
Generated code that reflects the data source in combination with Java as the query language enables full type-safety. Syntax errors are discovered in real time rather than weeks into the testing phase or even worse, in production!
UTILIZE TAB COMPLETION
Unsure what tables or columns that are available in the data source? You can trust tab-completion to fill in any gaps.

Contribute

The Speedment Open Source project is available under the Apache 2.0 License. We gladly welcome, and encourage contributions from the community. If you have something to add, need to file an issue or simply want to browse the source code, pay the project a visit on GitHub.