本文整理汇总了Java中org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext.setPersistenceUnitName方法的典型用法代码示例。如果您正苦于以下问题:Java ODataJPAContext.setPersistenceUnitName方法的具体用法?Java ODataJPAContext.setPersistenceUnitName怎么用?Java ODataJPAContext.setPersistenceUnitName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext
的用法示例。
在下文中一共展示了ODataJPAContext.setPersistenceUnitName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = this.getODataJPAContext();
try {
EntityManagerFactory emf = JpaEntityManagerFactory.getEntityManagerFactory();
oDataJPAContext.setEntityManagerFactory(emf);
oDataJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
return oDataJPAContext;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例2: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = getODataJPAContext();
EntityManagerFactory factory = (EntityManagerFactory) SpringContextsUtil.getBean(ENTITY_MANAGER_FACTORY_ID);
oDataJPAContext.setEntityManagerFactory(factory);
oDataJPAContext.setPersistenceUnitName(DEFAULT_ENTITY_UNIT_NAME);
oDataJPAContext.setJPAEdmExtension(new JPAEdmExtension());
ODataContextUtil.setODataContext(oDataJPAContext.getODataContext());
return oDataJPAContext;
}
示例3: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = getODataJPAContext();
EntityManagerFactory factory = (EntityManagerFactory) SpringContextsUtil.getBean(ENTITY_MANAGER_FACTORY_ID);
oDataJPAContext.setEntityManagerFactory(factory);
oDataJPAContext.setPersistenceUnitName(DEFAULT_ENTITY_UNIT_NAME);
oDataJPAContext.setJPAEdmExtension(new JPAEdmExtension());
ODataContextUtil.setODataContext(oDataJPAContext.getODataContext());
return oDataJPAContext;
}
示例4: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
//LocalEdmExtensions ext = new LocalEdmExtensions();
ODataJPAContext oDatJPAContext = this.getODataJPAContext();
try {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
// Load seed data
if (first_invocation) {
DataLoader m = new DataLoader( emf );
Utility.setEntityManagerFactory( emf );
m.loadData();
first_invocation = false;
}
oDatJPAContext.setEntityManagerFactory(emf);
oDatJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
// This file must be located in the same folder as "WEB-INF" in the WAR archive
oDatJPAContext.setJPAEdmMappingModel("map-tuning.xml");
//oDatJPAContext.setJPAEdmExtension(ext);
setDetailErrors(true);
//setErrorLevel();
return oDatJPAContext;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
示例5: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
ODataJPAContext context = getODataJPAContext();
context.setEntityManagerFactory(HerokuEntityManagerFactory.getInstance());
context.setPersistenceUnitName(HerokuEntityManagerFactory.PUNIT_NAME);
return context;
}
示例6: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = getODataJPAContext();
oDataJPAContext.setEntityManagerFactory(JPAEntityManagerFactory.getEntityManagerFactory(PUNIT_NAME));
oDataJPAContext.setPersistenceUnitName(PUNIT_NAME);
oDataJPAContext.setJPAEdmMappingModel(MAPPING_MODEL);
oDataJPAContext.setJPAEdmExtension(new SalesOrderProcessingExtension());
oDataJPAContext.setPageSize(PAGE_SIZE);
oDataJPAContext.setDefaultNaming(false);
oDataJPAContext.getODataContext().setDebugMode(true);
setErrorLevel();
setOnWriteJPAContent(onDBWriteContent);
return oDataJPAContext;
}
示例7: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = getODataJPAContext();
EmfHolder emfHolder = EmfHolder.createInstance();
oDataJPAContext.setEntityManagerFactory(emfHolder.getEntityManagerFactory());
oDataJPAContext.setPersistenceUnitName(emfHolder.getPersistenceUnitName());
oDataJPAContext.setPageSize(PAGE_SIZE);
setDetailErrors(true);
return oDataJPAContext;
}
示例8: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = this.getODataJPAContext();
try {
EntityManagerFactory emf = Persistence
.createEntityManagerFactory(persistenceUnitName);
oDataJPAContext.setEntityManagerFactory(emf);
oDataJPAContext.setPersistenceUnitName(persistenceUnitName);
return oDataJPAContext;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例9: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = this.getODataJPAContext();
try {
EntityManagerFactory emf = JpaEntityManagerFactory
.getEntityManagerFactory();
oDataJPAContext.setEntityManagerFactory(emf);
oDataJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
return oDataJPAContext;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例10: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = this.getODataJPAContext();
try {
oDataJPAContext.setEntityManagerFactory(EntityManagerFactoryProvider.getInstance().getEntityManagerFactory());
oDataJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
oDataJPAContext.setJPAEdmExtension(new BenefitsJPAEdmExtension());
setContextInThreadLocal(oDataJPAContext.getODataContext());
return oDataJPAContext;
} catch (Exception e) {
throw new ODataRuntimeException("Cannot initialize OData JPA Context", e); //$NON-NLS-1$
}
}
示例11: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入方法依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
ODataJPAContext oDatJPAContext = this.getODataJPAContext();
try {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
Utility.setEntityManagerFactory( emf );
// Load seed data
if (first_invocation) {
DataLoader m = new DataLoader( emf );
m.loadData();
first_invocation = false;
}
oDatJPAContext.setEntityManagerFactory(emf);
oDatJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
// This file must be located in the same folder as "WEB-INF" in the WAR archive
oDatJPAContext.setJPAEdmMappingModel("map-tuning.xml");
OChatProcessingExtension ext = new OChatProcessingExtension();
oDatJPAContext.setJPAEdmExtension(ext);
setDetailErrors(true);
//setErrorLevel();
return oDatJPAContext;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}