Source Code

Provides a Ceylonic EntityManager for use with the Java Persistence API. An EntityManager may be instantiated directly, given an instance of javax.persistence.EntityManager.

value emf = Persistence.createEntityManagerFactory("example");
value em = EntityManger(emf.createEntityManager());

The EntityManager provides all the same operations as javax.persistence.EntityManager, but:

  1. is slightly more typesafe, and
  2. accepts Integer, Float, String, Character, and Boolean, arguments to EntityManager.find(), EntityManager.getReference() and TypedQuery.setParameter().

Note: it's perfectly possible to directly use the javax.persistence.EntityManager from Ceylon, but in that case, it's necessary to explicitly convert arguments to java.lang.Long (java.lang::Long), java.lang.Double (java.lang::Double), java.lang.String (java.lang::String), java.lang.Character (java.lang::Character), or java.lang.Boolean (java.lang::Boolean).

Platform: Java

Default documentation for package ceylon.interop.persistence.


Criteria query API.


Default documentation for package ceylon.interop.persistence.

PropertiesSource Codeshared Properties=> Map<String,Object>

A Map associating string keys with items.

EntityManagerSource Codeshared EntityManager

Used to interact with a persistence context. Based closely on javax.persistence.EntityManager, but automatically manages conversions between Ceylon types and corresponding Java types, without the need for JPA AttributeConverters.

An EntityManager instance is associated with a persistence context. A persistence context is a set of entity instances in which for any persistent entity identity there is a unique entity instance. Within the persistence context, the entity instances and their lifecycle are managed. The EntityManager API is used to create and remove persistent entity instances, to find entities by their primary key, and to query over entities.

The set of entities that can be managed by a given EntityManager instance is defined by a persistence unit. A persistence unit defines the set of all classes that are related or grouped by the application, and which must be colocated in their mapping to a single database.

QuerySource Codeshared Query
QueryResultsSource Codeshared QueryResults

Used to obtain the results of a stored procedure query.

TypedQuerySource Codeshared TypedQuery<out Result = Object>
given Result satisfies Object

Used to control query execution. Based closely on javax.persistence.TypedQuery, but automatically manages conversions between Ceylon types and corresponding Java types, without the need for JPA AttributeConverters.