com.github.zhengframework.jpa.eclipselink.EclipseLinkEntityManagerFactoryProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zheng-jpa-eclipselink Show documentation
Show all versions of zheng-jpa-eclipselink Show documentation
zheng framework module: jpa support by eclipse link
package com.github.zhengframework.jpa.eclipselink;
import com.github.zhengframework.jpa.EntityManagerFactoryProvider;
import com.github.zhengframework.jpa.PersistenceUnitInfoImpl;
import java.net.MalformedURLException;
import java.net.URL;
import javax.persistence.EntityManagerFactory;
import javax.persistence.spi.PersistenceUnitInfo;
import org.eclipse.persistence.jpa.PersistenceProvider;
public class EclipseLinkEntityManagerFactoryProvider implements EntityManagerFactoryProvider {
@Override
public EntityManagerFactory get(PersistenceUnitInfo persistenceUnitInfo) {
try {
PersistenceUnitInfoImpl persistenceUnitInfo1 = (PersistenceUnitInfoImpl) persistenceUnitInfo;
//fake root url
persistenceUnitInfo1
.setPersistenceUnitRootUrl(new URL("http://localhost/"));
return new PersistenceProvider()
.createContainerEntityManagerFactory(persistenceUnitInfo1, null);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy