All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tapestry5.jpa.EntityManagerManager Maven / Gradle / Ivy

There is a newer version: 5.9.0-preview-2
Show newest version
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.apache.tapestry5.jpa;

import javax.persistence.EntityManager;
import java.util.Map;

/**
 * Manages EntityManagers for the current thread.
 * An EntityManager is created as needed and closed at the end of each request.
 *
 *
 *
 * The implementation of this service is per-thread.
 *
 * @since 5.3
 */
public interface EntityManagerManager
{
    /**
     * Gets the active EntityManager for this request, creating it as necessary.
     *
     * @param persistenceUnitName the name of a persistence unit as defined in {@code persistence.xml}
     * @return EntityManager for the persistence unit,
     */
    EntityManager getEntityManager(String persistenceUnitName);

    /**
     * Gets all active EntityManagers for this request, creating them as necessary.
     *
     * @return Map in which persistence unit names are associated with EntityManagers
     */
    Map getEntityManagers();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy