当前位置: 首页 > 知识库问答 >
问题:

未实现Olingo OData V2读取属性

蓝夕
2023-03-14
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code/>
           <message xml:lang="de-DE">Not implemented</message>
</error>
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory;
import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;


public class JPAODataServiceFactory extends ODataJPAServiceFactory
{

    private static final String PERSISTENCE_UNIT_NAME = "MyPersistenceUnitName";

    @Override
    public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException
    {

        ODataJPAContext oDatJPAContext = this.getODataJPAContext();
        try
        {
            EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
            oDatJPAContext.setEntityManagerFactory(emf);
            oDatJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);

            return oDatJPAContext;

        } catch (Exception e)
        {

            throw new RuntimeException(e);

        }

    }

暂时还没有答案

 类似资料: