org.apache.olingo.odata2.jpa.processor.ref.web
Class JPAReferenceServiceFactory

java.lang.Object
  extended by org.apache.olingo.odata2.api.ODataServiceFactory
      extended by org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory
          extended by org.apache.olingo.odata2.jpa.processor.ref.web.JPAReferenceServiceFactory

public class JPAReferenceServiceFactory
extends ODataJPAServiceFactory


Field Summary
static OnJPAWriteContent onDBWriteContent
           
 
Fields inherited from class org.apache.olingo.odata2.api.ODataServiceFactory
FACTORY_CLASSLOADER_LABEL, FACTORY_LABEL, PATH_SPLIT_LABEL
 
Constructor Summary
JPAReferenceServiceFactory()
           
 
Method Summary
 ODataJPAContext initializeODataJPAContext()
          Implement this method and initialize OData JPA Context.
 
Methods inherited from class org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory
createService, getCallback, getODataJPAContext, setDetailErrors, setOnWriteJPAContent
 
Methods inherited from class org.apache.olingo.odata2.api.ODataServiceFactory
createODataSingleProcessorService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

onDBWriteContent

public static final OnJPAWriteContent onDBWriteContent
Constructor Detail

JPAReferenceServiceFactory

public JPAReferenceServiceFactory()
Method Detail

initializeODataJPAContext

public ODataJPAContext initializeODataJPAContext()
                                          throws ODataJPARuntimeException
Description copied from class: ODataJPAServiceFactory
Implement this method and initialize OData JPA Context. It is mandatory to set an instance of type EntityManagerFactory into the context. An exception of type ODataJPARuntimeException is thrown if EntityManagerFactory is not initialized.

Sample Code:

public class JPAReferenceServiceFactory extends ODataJPAServiceFactory{

private static final String PUNIT_NAME = "punit";
public ODataJPAContext initializeODataJPAContext() {
ODataJPAContext oDataJPAContext = this.getODataJPAContext();
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PUNIT_NAME);
oDataJPAContext.setEntityManagerFactory(emf); oDataJPAContext.setPersistenceUnitName(PUNIT_NAME);
return oDataJPAContext;
}
}

Specified by:
initializeODataJPAContext in class ODataJPAServiceFactory
Returns:
an instance of type ODataJPAContext
Throws:
ODataJPARuntimeException


Copyright © 2013-2015 The Apache Software Foundation. All Rights Reserved.