Quick Start OSS

Thank you for downloading Speedment OSS. This guide will take you through the installation process. If you run into trouble or have questions, don’t hesitate to reach out to our developers and other users on Gitter.

If you intend to upgrade your project, please visit our guide on how to upgrade an existing project to the full version.

Requirements

Before proceeding, make sure you have the following tools installed:

  • JDK 8.0.40 or later version
  • Apache Maven 3.3.9 or later version

1. Unzip the Project File

Start by unpacking the content of the downloaded zip-file. It contains a structured Speedment project with a pom.xml-file and a main.java.

Speedment Folder Structure

2. Start the Speedment Tool

Speedment uses JSON configuration files to generate Java code from your database. The JSON files will be created using the Speedment Tool. You can choose to start the Tool from your IDE* or run it from the command line.

With the Command Line

Locate the directory of the pom.xml-file and run the following:

mvn speedment:tool

With Your IDE

Import the contents of the downloaded zip-file as a Maven project. A number of Maven goals associated with Speedment will be available. Use speedment:tool to connect to your database and generate a Java representation of the domain model.

Note: If you wish to use an existing JSON file, use speedment:generate instead.

Speedment Maven Goals

3. Connect to Your Database

Next, simply fill out the database credentials and hit Connect. For security reasons, Speedment never stores the database password in generated classes or configuration files.

Connect OSS

4. Generate a Java Representation of the Database

Speedment now analyses the underlying data sources’ metadata and automatically creates code which directly reflects the structure (i.e. the “domain model”) of the data sources. Once finished, the database structure is visualized as a tree in the appearing window. To generate the object-oriented Java representation, press Generate.

Generate OSS

5. Write Your Speedment Application

Once the files are generated, you are ready to write your first Java Stream query. In the folder containing the generated files, there is a generated application entry point. The entry point constitutes a base for your application and looks something like this:

public class DemoApplicationEntryPoint {
    
    public static void main(final String... args) {
        DemoApplication app = new DemoApplicationBuilder()
            .withUsername("your-dbms-username")
            .withPassword("your-dbms-password")
            .build(); 
        
        app.close();
    }
}

NOTE: The name of the application builder will differ depending on the name of your data source. Hence, the instantiation of DemoApplication needs to use your specific builder. The builder is automatically generated in Step 5. You can identify the name of the builder in the src/main/java-folder (see image below). For this application, the builder is named SakilaApplicationBuilder and the resulting object implements SakilaApplication (Sakila is the name of the database) meaning the row in the template needs to be updated accordingly:

What’s next?

Now that you are up and running, it is time to start exploring the features of Speedment. We have gathered some resources below to help you get productive in no time.

Happy coding!


*Although these instructions might also work on other variants, we have only tested these instructions on the following IDEs:

  • Netbeans 8.2
  • IDEA 2018.1 Community Edition
  • Eclipse Oxygen