Last updated Jul 16, 2024

Creating an EntityManager

The EntityManager is the corner stone of Active Objects.

The simplest way to create and configure an entity manager is by using the

EntityManager entityManager = EntityManagerBuilder
                .url(jdbcProperties.url) // the JDBC url for database connection
                .auto() // configuring the connection pool, auto detects connection pools on the classpath
                .useWeakCache() // an option to use weak caches
                .build(); // actually builds the entity manager

That's all there is to it.

This example is obviously extracted from the the dog food blog.

When in an Atlassian plugin

There is no need for you to create your own entity manager, this is handled by the Active Objects plugin.

Rate this page: