package jp.bne.deno.ordermaid.common;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import com.google.inject.Provider;

/**
 * EJBのEntityManagerの設定を行う.
 * 
 * @author hasegawt
 * 
 */
public class EntityManagerProvider implements Provider<EntityManager> {
	private static EntityManagerFactory factory = null;

	// @Override
	public EntityManager get() {
		if (factory == null) {
			factory = Persistence.createEntityManagerFactory("order");
		}
		return factory.createEntityManager();
	}

}
