EntityManagerProducer.java 1.35 KB
package net.ziemers.swxercise.db.dao;

import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * Der Producer stellt einen Entity Manager zur Verfügung, sofern die Anwendung im JEE-Container
 * des WildFly Servers läuft. Läuft sie im Testkontext in ihrem Weld-Server, funktioniert dies
 * naturgegeben nicht, und es wird der alternative Producer verwendet, der sich in der Klasse
 * "JpaTestUtils" im Paket "test.java.net.ziemers.swxercise.db.utils befindet".
 *
 * Copyright (c) 2017 Dipl.-Inform. Thomas Ziemer
 *
 * This file is part of swXercise.
 *
 * swXercise is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * swXercise is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with swXercise.
 * If not, see <http://www.gnu.org/licenses/>.
 */
public class EntityManagerProducer {

    @Produces
    @PersistenceContext
    private EntityManager entityManager;

}