org.apache.olingo.odata2.jpa.processor.ref.web
Class JPAReferenceServiceFactory
java.lang.Object
org.apache.olingo.odata2.api.ODataServiceFactory
org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory
org.apache.olingo.odata2.jpa.processor.ref.web.JPAReferenceServiceFactory
public class JPAReferenceServiceFactory
- extends ODataJPAServiceFactory
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
onDBWriteContent
public static final OnJPAWriteContent onDBWriteContent
JPAReferenceServiceFactory
public JPAReferenceServiceFactory()
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.