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

org.apache.openejb.persistence.QueryLogEntityManager Maven / Gradle / Ivy

The newest version!
/*
 * 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.openejb.persistence;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.FlushModeType;
import javax.persistence.LockModeType;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.metamodel.Metamodel;
import java.util.Map;

public class QueryLogEntityManager implements EntityManager {
    private final EntityManager delegate;
    private final String level;

    public QueryLogEntityManager(final EntityManager entityManager, final String level) {
        delegate = entityManager;
        this.level = level;
    }

    @Override
    public void persist(final Object entity) {
        delegate.persist(entity);
    }

    @Override
    public  T merge(final T entity) {
        return delegate.merge(entity);
    }

    @Override
    public void remove(final Object entity) {
        delegate.remove(entity);
    }

    @Override
    public  T find(final Class entityClass, final Object primaryKey) {
        return delegate.find(entityClass, primaryKey);
    }

    @Override
    public  T find(final Class entityClass, final Object primaryKey, final Map properties) {
        return delegate.find(entityClass, primaryKey, properties);
    }

    @Override
    public  T find(final Class entityClass, final Object primaryKey, final LockModeType lockMode) {
        return delegate.find(entityClass, primaryKey, lockMode);
    }

    @Override
    public  T find(final Class entityClass, final Object primaryKey, final LockModeType lockMode, final Map properties) {
        return delegate.find(entityClass, primaryKey, lockMode, properties);
    }

    @Override
    public  T getReference(final Class entityClass, final Object primaryKey) {
        return delegate.getReference(entityClass, primaryKey);
    }

    @Override
    public void flush() {
        delegate.flush();
    }

    @Override
    public void setFlushMode(final FlushModeType flushMode) {
        delegate.setFlushMode(flushMode);
    }

    @Override
    public FlushModeType getFlushMode() {
        return delegate.getFlushMode();
    }

    @Override
    public void lock(final Object entity, final LockModeType lockMode) {
        delegate.lock(entity, lockMode);
    }

    @Override
    public void lock(final Object entity, final LockModeType lockMode, final Map properties) {
        delegate.lock(entity, lockMode, properties);
    }

    @Override
    public void refresh(final Object entity) {
        delegate.refresh(entity);
    }

    @Override
    public void refresh(final Object entity, final Map properties) {
        delegate.refresh(entity, properties);
    }

    @Override
    public void refresh(final Object entity, final LockModeType lockMode) {
        delegate.refresh(entity, lockMode);
    }

    @Override
    public void refresh(final Object entity, final LockModeType lockMode, final Map properties) {
        delegate.refresh(entity, lockMode, properties);
    }

    @Override
    public void clear() {
        delegate.clear();
    }

    @Override
    public void detach(final Object entity) {
        delegate.detach(entity);
    }

    @Override
    public boolean contains(final Object entity) {
        return delegate.contains(entity);
    }

    @Override
    public LockModeType getLockMode(final Object entity) {
        return delegate.getLockMode(entity);
    }

    @Override
    public void setProperty(final String propertyName, final Object value) {
        delegate.setProperty(propertyName, value);
    }

    @Override
    public Map getProperties() {
        return delegate.getProperties();
    }

    @Override
    public Query createQuery(final String qlString) {
        return delegate.createQuery(qlString);
    }

    @Override
    public  TypedQuery createQuery(final CriteriaQuery criteriaQuery) {
        return new CriteriaLogQuery(delegate.createQuery(criteriaQuery), level);
    }

    @Override
    public  TypedQuery createQuery(final String qlString, final Class resultClass) {
        return delegate.createQuery(qlString, resultClass);
    }

    @Override
    public Query createNamedQuery(final String name) {
        return delegate.createNamedQuery(name);
    }

    @Override
    public  TypedQuery createNamedQuery(final String name, final Class resultClass) {
        return delegate.createNamedQuery(name, resultClass);
    }

    @Override
    public Query createNativeQuery(final String sqlString) {
        return delegate.createNativeQuery(sqlString);
    }

    @Override
    public Query createNativeQuery(final String sqlString, final Class resultClass) {
        return delegate.createNativeQuery(sqlString, resultClass);
    }

    @Override
    public Query createNativeQuery(final String sqlString, final String resultSetMapping) {
        return delegate.createNativeQuery(sqlString, resultSetMapping);
    }

    @Override
    public void joinTransaction() {
        delegate.joinTransaction();
    }

    @Override
    public  T unwrap(final Class cls) {
        return delegate.unwrap(cls);
    }

    @Override
    public Object getDelegate() {
        return delegate.getDelegate();
    }

    @Override
    public void close() {
        delegate.close();
    }

    @Override
    public boolean isOpen() {
        return delegate.isOpen();
    }

    @Override
    public EntityTransaction getTransaction() {
        return delegate.getTransaction();
    }

    @Override
    public EntityManagerFactory getEntityManagerFactory() {
        return delegate.getEntityManagerFactory();
    }

    @Override
    public CriteriaBuilder getCriteriaBuilder() {
        return delegate.getCriteriaBuilder();
    }

    @Override
    public Metamodel getMetamodel() {
        return delegate.getMetamodel();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy