Skip to content

Instantly share code, notes, and snippets.

@skempken
skempken / InMemoryDbFixture.java
Created January 13, 2014 15:02
Creates a JPA EntityManager in code with a H2 in-memory database based on entity classes.
import org.hibernate.ejb.Ejb3Configuration;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import java.util.Collection;
import java.util.Properties;
public class InMemoryDbFixture {
private String scope;