Users that are connecting to SQL databases via JDBC connections will need to download the ormlite-jdbc-4.48.jar
and ormlite-core-4.48.jar files. For use with Android applications, you should download the
ormlite-android-4.48.jar and ormlite-core-4.48.jar files instead. For either JDBC or
Android you will also need the ormlite-core release which has the ORMLite backend implementations. ORMLite does not have
any required external dependencies although there are some optional packages that you may want to use. See section External Dependencies. The
code works with Java 5 or later.

1.2 Configuring a Class

The following is an example class that is configured to be persisted to a database using ORMLite annotations. The @DatabaseTable
annotation configures the Account class to be persisted to the database table named accounts. The @DatabaseField annotations map
the fields on the Account to the database columns with the same names.

The name field is configured as the primary key for the database table by using the id = true annotation field. Also, notice that a
no-argument constructor is needed so the object can be returned by a query. For more information (JPA annotations and other ways to configure
classes) see the class setup information later in the manual. See section Setting Up Your Classes.

1.3 Configuring a DAO

A typical Java pattern is to isolate the database operations in Data Access Objects (DAO) classes. Each DAO provides create, delete,
update, etc. type of functionality and specializes in the handling a single persisted class. A simple way to build a DAO is
to use the createDao static method on the DaoManager class. For example, to create a DAO for the Account class
defined above you would do:

1.4 Code Example

This example uses the native Java H2 database to create an in-memory test database. You will need to download and add the H2 jar file to your
classpath if you want to run the example as-is. See the H2 home page. NOTE:
Android users should see the Android specific documentation later in the manual. See section Using With Android. There are also complete code
examples that can be used. See section Example Code.

The code performs the following steps.

It creates a connection source which handles connections to the database.

It instantiates a DAO for the Account object.

The accounts database table is created. This step is not needed if the table already exists.