org.apache.openjpa.persistence.OpenJPAEntityManagerFactory Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.openjpa.persistence;
import java.io.Serializable;
import java.util.Map;
import java.util.Set;
import javax.persistence.EntityManagerFactory;
import org.apache.openjpa.persistence.criteria.OpenJPACriteriaBuilder;
import org.apache.openjpa.persistence.query.QueryBuilder;
/**
* Interface implemented by OpenJPA entity manager factories.
*
* @author Abe White
* @since 0.4.0
* @published
*/
public interface OpenJPAEntityManagerFactory
extends EntityManagerFactory, Serializable {
/**
* Return properties describing this runtime.
*/
@Override Map getProperties();
/**
* Put the specified key-value pair into the map of user objects.
*/
Object putUserObject(Object key, Object val);
/**
* Get the value for the specified key from the map of user objects.
*/
Object getUserObject(Object key);
/**
* Access the level 2 store cache. This cache acts as a proxy to all
* named caches.
*/
StoreCache getStoreCache();
/**
* Access a named level 2 store cache.
*/
StoreCache getStoreCache(String name);
/**
* Access query result cache.
*/
QueryResultCache getQueryResultCache();
@Override OpenJPAEntityManager createEntityManager();
/**
* Return an entity manager with the provided additional configuration
* settings. OpenJPA recognizes the following configuration settings in this
* method:
*
* - openjpa.ConnectionUsername
* - openjpa.ConnectionPassword
* - openjpa.ConnectionRetainMode
* - openjpa.TransactionMode
*
*/
@Override OpenJPAEntityManager createEntityManager(Map props);
/**
* @deprecated use {@link ConnectionRetainMode} enums instead.
*/
@Deprecated int CONN_RETAIN_DEMAND = 0;
/**
* @deprecated use {@link ConnectionRetainMode} enums instead.
*/
@Deprecated int CONN_RETAIN_TRANS = 1;
/**
* @deprecated use {@link ConnectionRetainMode} enums instead.
*/
@Deprecated int CONN_RETAIN_ALWAYS = 2;
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
@Deprecated org.apache.openjpa.conf.OpenJPAConfiguration getConfiguration();
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
@Deprecated void addLifecycleListener(Object listener, Class... classes);
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
@Deprecated void removeLifecycleListener(Object listener);
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
@Deprecated void addTransactionListener(Object listener);
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
@Deprecated void removeTransactionListener(Object listener);
/**
* Gets a builder for dynamic queries.
*/
QueryBuilder getDynamicQueryBuilder();
/**
* Gets the QueryBuilder with OpenJPA-extended capabilities.
*
* @since 2.0.0
*/
@Override OpenJPACriteriaBuilder getCriteriaBuilder();
/**
* Get the properties supported by this runtime.
*
* @since 2.0.0
*/
Set getSupportedProperties();
}