7.2. Obtaining EntityManagers

public EntityManager createEntityManager ();
public EntityManager createEntityManager (Map map);

The two createEntityManager methods above create a new EntityManager each time they are invoked. The optional Map is used to to supply vendor-specific settings. If you have configured your implementation for JTA transactions and a JTA transaction is active, the returned EntityManager will be synchronized with that transaction.

[Note]Note

Kodo recognizes the following string keys in the map supplied to createEntityManager:

  • kodo.ConnectionUserName

  • kodo.ConnectionPassword

  • kodo.ConnectionRetainMode

  • kodo.TransactionMode

  • kodo.<property>, where <property> is any JavaBean property of the kodo.persistence.KodoEntityManager.

The last option uses reflection to configure any property of Kodo's EntityManager implementation with the value supplied in your map. The first options correspond exactly to the same-named Kodo configuration keys described in Chapter 2, Configuration of the Reference Guide.

 

Skip navigation bar   Back to Top