No description or website provided.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Build Status


Add the ability to inject EntityManagers for a certain persistence unit in Eclipse 4.

Getting Started

Target platform - Repositories

First of all you have to get the Gemini JPA and Gemini DBAccess bundles to make this work. A sample target platform for Juno is available here.

The p2 repositories

Inject it

You can directly inject an EntityManager via

EntityManager em;

or you can inject an EntityManagerFactory if you want to have more control of your EntityManagers

EntityManager em;


You can even configure your persistence units within the inject annotation.

@GeminiPersistenceContext(unitName="puTest", properties = {
 @GeminiPersistenceProperty(name=PersistenceUnitProperties.JDBC_DRIVER, value=""),
 @GeminiPersistenceProperty(name=PersistenceUnitProperties.JDBC_URL, value="jdbc:mysql://"),
 @GeminiPersistenceProperty(name=PersistenceUnitProperties.JDBC_USER, value="test"),
 @GeminiPersistenceProperty(name=PersistenceUnitProperties.JDBC_PASSWORD, value="test"))
EntityManager em;

even with the Preference annotation. If you don't know them take a look here

@GeminiPersistenceContext(unitName = "unconfigured2", properties = {
  @GeminiPersistenceProperty(name = PersistenceUnitProperties.JDBC_DRIVER, valuePref = @Preference("jdbc_driver")),
  @GeminiPersistenceProperty(name = PersistenceUnitProperties.JDBC_URL, valuePref = @Preference("jdbc_url")) })
private EntityManager em;

Sample application

A complete sample application can be found here. It contains examples for

  • Statically injected contexts
  • Dynamically injected contextes
  • Handling changing preferences with DAOs


This repository contains the work done by Filipp A. and Nepomuk Seiler. See Gemini Forum Post for more information.