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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static OnJPAWriteContent` | `onDBWriteContent`

    - ### Fields inherited from class org.apache.olingo.odata2.api.ODataServiceFactory

      `ACCEPT_FORM_ENCODING, FACTORY_CLASSLOADER_LABEL, FACTORY_INSTANCE_LABEL, FACTORY_LABEL, PATH_SPLIT_LABEL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JPAReferenceServiceFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ODataSingleProcessor` | `createCustomODataProcessor(ODataJPAContext context)`
    `<T extends ODataCallback> T` | `getCallback(Class<T> callbackInterface)` A service can return implementation classes for various callback interfaces.
    `ODataJPAContext` | `initializeODataJPAContext()` Implement this method and initialize OData JPA Context.

    - ### Methods inherited from class org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory

      `createService, getODataJPAContext, setDetailErrors, setODataJPATransaction, 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`

    - #### createCustomODataProcessor

          public ODataSingleProcessor createCustomODataProcessor(ODataJPAContext context)

      Overrides:
        `createCustomODataProcessor` in class `ODataJPAServiceFactory`

    - #### getCallback

          public <T extends ODataCallback> T getCallback(Class<T> callbackInterface)

      Description copied from class: `ODataServiceFactory`
      A service can return implementation classes for various callback interfaces.
      Overrides:
        `getCallback` in class `ODataJPAServiceFactory`
      Parameters:
        `callbackInterface` - a interface type to query for implementation
      Returns:
        a callback implementation for this interface or null

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