GithubHelp home page GithubHelp logo

sap / olingo-jpa-processor-v4 Goto Github PK

View Code? Open in Web Editor NEW
121.0 22.0 76.0 13.41 MB

The JPA Processor fills the gap between Olingo V4 and the database, by providing a mapping between JPA metadata and OData metadata, generating queries and supporting the entity manipulations.

License: Apache License 2.0

D 0.01% Java 99.99%

olingo-jpa-processor-v4's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

olingo-jpa-processor-v4's Issues

Server side paging: broken link on the next page

Hi!

We were faced with one problem during server side pagination testing. Link on the next page is broken:

Actual result (by this link we can't get result):

"@odata.nextLink": "MediaEntities?$skiptoken='1c038bc8-bb6a-4ac0-8253-9f4117ceb9f1'"

Expected result (skip token should be without single quotes and by this link we can get result):

"@odata.nextLink": "MediaEntities?$skiptoken=1c038bc8-bb6a-4ac0-8253-9f4117ceb9f1"

$metadata with accept header json

Hi,
Calling $metadata with Accept header with value: application/json causing:
"message": "The content-type range 'application/json' is not supported as value of the Accept header.",
"code": 406

Is there a way to support json response for $metadata as well?

Thanks,
Chen

ManyToOne Mapping throws exception "com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException: Error when creating Referential Constraints"

I am trying to make a simple demo application using this library. I get the above error when using a ManyToOne mapping between my entities.

Entity BeerRating

  @Id
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BEER_RATING_ID_GENERATOR")
  @Column(name = "ID", nullable = false, precision = 10)
  private BigDecimal id;

  @ManyToOne
  @JoinColumn(name = "BEER_ID", referencedColumnName = "ID")
  private Beer beer;

Entity Beer

@Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BEER_ID_GENERATOR")
    @Column(name = "ID", nullable = false, precision = 10)
    private BigDecimal id;

    @Column(name = "NAME", nullable = false)
    private String name;

    @Column(name = "BRAND", nullable = false)
    private String brand;

Pagination

Hi,
Is there a way to do automatic pagination on the server in case the number of retrieved data is to big?

Thanks...
Chen

Enitites filtering

Is it possible somehow filter enitites or enity fields on the fly?

want to provide or not provide some information depending on user account.

In param is not working in filter

Hello,
When trying to filter strings according to "in (?, ?....)"
I'm getting this error:
"The types 'Edm.Boolean' and 'Edm.String' are not compatible.".

Thanks

expand inside an expand

Hi,
Is there a way to expand entity from an expand entity.
Meaning to expand more than one layer.
for example :
/Projects?$expand=Scan

now i also would like to expand things from scan
Is it possible?

Thanks,
Chen

JSON value representation

Let's imagine I have a column which holds JSON/JSONB representation of internal information for triggering or caching policy handling, whatever.
Let's imagine also a lot of tables have such column. From table to table 80% of information has the same structure. For example:

{
   "date_created":"2017-12-28 16:15:48.381194+06",
   "date_updated":"2017-12-08 17:42:33.133355+06",
   "is_active":true,
   "is_withdrawn":false,
   "premission_type":"SPECIAL",
   "cache_key":"some_unique_cache_key",
   "cache_expiration":"3600"
}

Of course JSON type if not supported by Olingo according to https://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/edm/EdmPrimitiveType.html
and I have to treat it as STRING. But Apache can't process big structures and produces an error in https://github.com/apache/olingo-odata4/blob/d9aff6300f61750d7f1a20d8ae58c322d8cde4e3/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java#L857

Will report issue on Apache later.

So finally, querying entity getting this

{
   "@odata.context":"$metadata#Table_Companies",
   "value":[
      {
         "Data":"{ \"date_created\":\"2017-12-28 16:15:48.381194+06\", \"date_updated\":\"2017-12-08 17:42:33.133355+06\", \"is_active\":true, \"is_withdrawn\":false, \"premission_type\":\"SPECIAL\", \"cache_key\":\"some_unique_cache_key\", \"cache_expiration\":\"3600\"} ",
         "Identity":"1234567890123",
         "Name":"Company #1",
         "Id":4,
         "LegalFormId":1
      },
      {
         "Data":"{ \"date_created\":\"2017-12-28 16:15:48.381194+06\", \"date_updated\":\"2017-12-08 17:42:33.133355+06\", \"is_active\":true, \"is_withdrawn\":false, \"premission_type\":\"SPECIAL\", \"cache_key\":\"some_unique_cache_key\", \"cache_expiration\":\"3600\", \"another_key\": true}",
         "Identity":"120640010032",
         "Name":"Company #2",
         "Id":2,
         "LegalFormId":3
      }
   ]
}

Is there any idea how to get structure like this

{
   "@odata.context":"$metadata#Table_Companies",
   "value":[
      {
         "Data":{
            "date_created":"2017-12-28 16:15:48.381194+06",
            "date_updated":"2017-12-08 17:42:33.133355+06",
            "is_active":true,
            "is_withdrawn":false,
            "premission_type":"SPECIAL",
            "cache_key":"some_unique_cache_key",
            "cache_expiration":"3600"
         },
         "Identity":"1234567890123",
         "Name":"Company #1",
         "Id":4,
         "LegalFormId":1
      },
      {
         "Data":{
            "date_created":"2017-12-28 16:15:48.381194+06",
            "date_updated":"2017-12-08 17:42:33.133355+06",
            "is_active":false,
            "is_withdrawn":true,
            "premission_type":"INTERNAL",
            "cache_key":"some_unique_cache_key",
            "cache_expiration":"300",
            "SPECIAL_KEY_ONLY_FOR_THIS_ROW":true
         },
         "Identity":"120640010032",
         "Name":"Company #2",
         "Id":2,
         "LegalFormId":3
      }
   ]
}

I think I can use ComplexType but still not sure how to implement it and handle non standart keys like SPECIAL_KEY_ONLY_FOR_THIS_ROW

Any ideas?

Entities attributes order

Hi,
Is there a way to force the order of returned entities attributes?
For example:
"value": [
{
"Loc": 33610,
"RiskLevel": 100,
"Id": 1000000,
}

I want the id to be first
expected result:
"value": [
{
"Id": 1000000,
"Loc": 33610,
"RiskLevel": 100
}

$metadata not working with native test models

Tried to test Person entity taken from
olingo-jpa-processor-v4/jpa/odata-jpa-test/src/main/java/com/sap/olingo/jpa/processor/core/testmodel/Person.java

root URL it works perfectly

image

Collection is also works perfect

image

But $metadata not

image

Getting error
OData Library: An exception without message text was thrown.

Onse deleting Persons entity and related classes, $metadata works again

image

When will this will be uploaded to maven repo?

Hi, I was looking for such processor and I see the artifacts are not yet uploaded to public maven repo. Any idea when this would be available? It would be great if i get some time line details.

Thanks
Yathish

JPAODataClaimsProvider is not supporting not supporting $filter

Using filter expression using navigation like:

  • ...Companies?$select=ID&$filter=Roles/$count eq 2
  • ...Organizations?$filter=AdministrativeInformation/Created/User/LastName eq 'Mustermann'
  • ...AdministrativeDivisions?$filter=Parent/Parent/CodeID eq 'NUTS1' and DivisionCode eq 'BE212'

do not respect claims

Group by

Hi
does olingo support group by?
Thanks

$expand not following relation

I am having trouble getting a $expand to work. Details to follow. What am I doing wrong?

I have the following metadata:

image

As you can see, it has a link called Donations from Donor to Donation. I am using the following URL to attempt to follow the link:

localhost:8080/RESTGEB/Data.svc/Donors(1)?$expand=Donations

I get the following result:
image

The links in the objects look like this:

class Donor {
    ...
    @OneToMany(mappedBy="relatedDonor", fetch=FetchType.LAZY)
    private Collection<Donation> donations;
    ...
}

class Donation {
    @Id private long donor;
    @id private long tranId;

    @ManyToOne
    private Donor relatedDonor;	   
    ....
}

PS. Your error message should be "No join conditions were provided", not "where provided"?

Slow connection with JTDS

We are using JTDS version 1.3.1 and the connection management takes 6 seconds and it runs twice.
Trying to use Microsoft's JDBC driver was unsuccessful due to "connection is closed" error (despite the fact the connection URL and data source are legit).

The database is MSSql.

Please advice.

why there is a limitation regarding the number of $filter

The jar consists with a limitation that allows only one $filter.
Is there a way to change this limitation in the next version?
and allow request like this:
odata/v1/Projects?$filter=Id eq 1 &$filter=Name eq 'foo'

I know you can do it like this:
odata/v1/Projects?$filter=Id eq 1 and Name eq 'foo'

but our filter can be quiet complex, and it will be helpful to pass more than one filter

com.sap.olingo.jpa.metadata.core.edm.mapper.impl.IntermediateEntityType cannot be cast to com.sap.olingo.jpa.metadata.core.edm.mapper.impl.IntermediateComplexType

I'm getting this error when i try to join this way:
@manytoone(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JoinColumns({
@joincolumn(name = "projectId", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)})
@joincolumn(name = "dbsource_id", referencedColumnName = "dbsource_id", nullable = false, insertable = false, updatable = false)
private Project project;

Any idea why? how can i resolve it?

Server Diven Paging not working with Functions

in case a URI contains a Function and paging is used the calls fail with an error message:

while trying to invoke the method org.apache.olingo.commons.api.edm.EdmEntitySet.getName() of a null object returned from com.sap.olingo.jpa.processor.core.query.Util.determineTargetEntitySet(java.util.List)

Invalid value for property???

Hi:

I just got this error message:

<error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
    <code>null</code>
    <message>
        The value '801.79' is not valid for property 'Totdonations'
    </message>
</error>

The metadata for the field is:

<Property Name="Totdonations" Type="Edm.Decimal"/>

What is wrong? Why is 801.79 not valid for an Edm.Decimal???

Complex filter is creating more brackets than it should

Hi
If i am calling /Projects?$filter = Id eq 33 or Id eq 34
The query generated looks like:
select * from projects where ((Id = 33) or (id =34))
In a very complex query with many 'OR' this could cause problem.
The correct query should be something like this:
select * from projects where (Id = 33 or id =34)

porting to java7

FYI, I have created a new branch luca-vercelli/Java7 where software is backported to Java7
Hope it can be useful

JPA Processor requires explicit column name for expand

JPA allows that column names are not given when java field has the same name. In opposite to that requires the JPA Processor that the column name is always given.

The processor should also be able to use the field name if column name is not given.

Trouble with composite key where one part references an Entity

I am trying to set up a pretty simple relationship:

Donor - primary key ID (field name is ID in the table)

Donation - primary key is composite:
Donor ID (references donor - field name is DON_DON_ID in the table)
Transaction ID (makes the key unique - field name is TRANID in the table)

Here are my definitions:
``
public class DonationId implements Serializable {

private static final long serialVersionUID = 1L;

@Column(name="DON_DON_ID")
private long donor;

@Column(name="TRANID")
private long tranId;
...
}

@Entity(name="Donor")
@Table(schema="GEBOWNER", name="DONORS")
public class Donor {

@Id
@Column(name="ID")
private Long id;

@OneToMany(mappedBy="donor", fetch=FetchType.LAZY)
private Collection<Donation> donations;
   ...
}
  
@Entity(name="Donation")
@IdClass(DonationId.class)
@Table(schema="GEBOWNER", name="VW_DONTRANS")
public class Donation {

	@Id
	private long tranId;

	@ManyToOne
	@Id
	private Donor donor;	
    ...
}

``

The Metadata I get is this:
image

Look at the Key under Donation entity. It only shows TranID and does not show the Donor. Shouldn't it, since it is part of the Donation table key?

What am I doing wrong - or is something wrong with the metadata loader? What is the best way to debug this?

JPA interop fails with Hibernate 5.2.12.Final

I think this is an API version incompatibility so I'm filing an issue as requested in the README.

Trying to load the service URL produces this exception:

javax.servlet.ServletException: Servlet execution threw an exception
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause

java.lang.NoSuchMethodError: javax.persistence.JoinTable.indexes()[Ljavax/persistence/Index;
	org.hibernate.cfg.AnnotationBinder.bindJoinedTableAssociation(AnnotationBinder.java:2442)
	org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2141)
	org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:925)
	org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:752)
	org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:249)
	org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:222)
	org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
	org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:858)
	org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:885)
	org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
	javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78)
	javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
	com.x.odata.XxServiceFactory.initializeODataJPAContext(XxServiceFactory.java:27)
	org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory.createService(ODataJPAServiceFactory.java:125)
	org.apache.olingo.odata2.core.servlet.ODataServlet.handleRequest(ODataServlet.java:208)
	org.apache.olingo.odata2.core.servlet.ODataServlet.handle(ODataServlet.java:115)
	org.apache.olingo.odata2.core.servlet.ODataServlet.service(ODataServlet.java:85)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

My dependencies look like this:

libraryDependencies ++= Seq(
  "javax.ws.rs" % "javax.ws.rs-api" % "2.0.1" % "provided",
  // "javax.inject" % "javax.inject" % "1",
  "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
  "org.glassfish.jersey.containers" % "jersey-container-servlet" % "2.25.1",
  "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1",
  //"io.swagger" % "swagger-jaxrs" % "1.5.16",
  "io.swagger" % "swagger-jersey2-jaxrs" % "1.5.16",
  "org.flywaydb" % "flyway-core" % "4.2.0",  // Database migrations. https://flywaydb.org/
  //
  // OData service:
  "org.apache.olingo" % "olingo-odata2-core" % "2.0.10",
  "org.apache.olingo" % "olingo-odata2-api" % "2.0.10",
  "org.apache.olingo" % "olingo-odata2-api-annotation" % "2.0.10",
  "org.apache.olingo" % "olingo-odata2-jpa-processor-core" % "2.0.10",
  "org.apache.olingo" % "olingo-odata2-jpa-processor-api" % "2.0.10",
  "org.hibernate" % "hibernate-core" % "5.2.12.Final",
  //
  "mysql" % "mysql-connector-java" % "6.0.6",
  "ch.qos.logback" % "logback-classic" % "1.2.3",
  "org.apache.logging.log4j" % "log4j-core" % "2.9.1"
)

Custom search function

Hi,

Had anyone so far luck with implementing a custom query search function?
I followed the database processor example, but as soon as there is some kind of special character in the searchterm it stops working

This can be even a simple dash โ€ž-โ€ž, but the list goes on and on with other characters

Odata function using java classes does not support $expand.

I created Odata function which returns collection of entity A (let say). Entity A has collection of children entity B. I am able to generate metadata document. Odata function call is working. But, ../function()?$expand=B is not working properly. It does not given me error. It just does not expand B.

I think, it should support $expand when function returns collection of enitity.

filter & expand is not working

Hi,
When i am calling:
/Scans?$filter=Team/Level eq 4&$expand=Team
im getting:
OData Library: An exception without message text was thrown.

any idea why?

How can I query on filter date fields

Hello,when I request as url : $filter=StartDate eq datetime'2018-03-31T22:22:00'
it reponse message:The property 'datetime',use in a query expression,is not defined in type ......

Can we use JAX-RS server with your code?

Hi:

Rather than just using a plain servlet, can we use the full Apache CXF stack - specifically JAX-RS and the OAuth2 server implementation?

I am not expert in all of this, so any advice would be much appreciated.

If it matters, our base application is working fine based on your code and the tutorial. Thanks for the great work!

Eric Raskin

NoSuchMethodError

java.lang.NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator;
at org.reflections.Reflections.expandSuperTypes(Reflections.java:380)
at org.reflections.Reflections.(Reflections.java:126)
at com.sap.olingo.jpa.metadata.core.edm.mapper.impl.IntermediateServiceDocument.createReflections(IntermediateServiceDocument.java:263)


java.lang.NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator; at org.reflections.Reflections.expandSuperTypes(Reflections.java:380) at org.reflections.Reflections.(Reflections.java:126) at com.sap.olingo.jpa.metadata.core.edm.mapper.impl.IntermediateServiceDocument.createReflections(IntermediateServiceDocument.java:263) at com.sap.olingo.jpa.metadata.core.edm.mapper.impl.IntermediateServiceDocument.(IntermediateServiceDocument.java:61) at com.sap.olingo.jpa.metadata.core.edm.mapper.impl.JPAServiceDocumentFactory.getServiceDocument(JPAServiceDocumentFactory.java:26) at com.sap.olingo.jpa.metadata.api.JPAEdmProvider.(JPAEdmProvider.java:45) at tv.samim.iptv.yourPackage.common.OdataServlet.service(OdataServlet.java:49)
    ServletContext context = getServletContext();
            WebApplicationContext ctx =
                    WebApplicationContextUtils
                            .getWebApplicationContext(context);
            EntityManagerFactory emf = ctx.getBean("entityManagerFactory", EntityManagerFactory.class);

           // EntityManagerFactory myBean = (EntityManagerFactory) req.getSession().getAttribute("");
           // EntityManagerFactory emf = JPAEntityManagerFactory.getEntityManagerFactory(PUNIT_NAME, new HashMap<String, Object>());
            JPAEdmProvider metadataProvider = new JPAEdmProvider(PUNIT_NAME, emf, null, new String[]{"test"});
            OData odata = OData.newInstance();

CreateEntity when PrimaryKey is provided

Hi,

I am currently struggling with setting up an Data interface for an existing application. Unfortunately, it is providing a dummy value for the ID as soon as I want to create a new Entity. This CREATE results in the error message "Invalid value for property 'IdProduct'."
Is there any way around this? I cannot even reach the createEntity method when providing the ID

Unable to sort on fields that are part of composite key

While it is possible to filter on a field that is part of a composite key, trying to order by it will raise an exception with a message that looks like the following: Property for 'foo' not found at 'bar'.

A filter expression would filter correctly the foo field to 'bar.id.foo' while the order by is looking for 'bar.foo' which doesn't exist.

Enumerated values not supported when using JPAODataCRUDHandler or JPAODataGetHandler

Getting error

com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException: Type 'rest.Types.Permission' of attribute 'permission_type' is not supported. Mapping not possible.

Enumerated types as described in https://github.com/SAP/olingo-jpa-processor-v4/blob/develop/jpa-tutorial/Tutorials/Metadata/1-12-EnumerationTypes.md

work only with code

			EntityManagerFactory emf = JPAEntityManagerFactory.getEntityManagerFactory(PUNIT_NAME, new HashMap<String, Object>());
			JPAEdmProvider metadataProvider = new JPAEdmProvider(PUNIT_NAME, emf, null);

			OData odata = OData.newInstance();
			ServiceMetadata edm = odata.createServiceMetadata(metadataProvider, new ArrayList<EdmxReference>());
			ODataHttpHandler handler = odata.createHandler(edm);

			handler.process(req, resp);

but fail with

			JPAODataGetHandler handler = new JPAODataGetHandler(PUNIT_NAME,
					DataSourceHelper.createDataSource(DataSourceHelper.DB_HSQLDB));

			handler.process(req, resp);

or

			JPAODataCRUDHandler handler = new JPAODataCRUDHandler(PUNIT_NAME);
			handler.getJPAODataContext().setCUDRequestHandler(new CUDRequestHandler());
			handler.process(req, resp, em);

javax.persistence.PersistenceException: No Persistence provider for EntityManager named Tutorial

Do you have written tutorial code? I'm not sure if it's an environmental error.

Servlet.service() for servlet [Tutorial] in context with path [] threw exception [javax.persistence.PersistenceException: No Persistence provider for EntityManager named Tutorial] with root cause
javax.persistence.PersistenceException: No Persistence provider for EntityManager named Tutorial
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
at com.sap.olingo.jpa.metadata.api.JPAEntityManagerFactory.getEntityManagerFactory(JPAEntityManagerFactory.java:35)
at tutorial.service.Servlet.service(Servlet.java:29)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

how to get only odata count without value

Is there any way I can get only count of the data in response payload without any value array?

I just need something like "@odata.count":1, "value":[] or without "value".

I tried $count=true&$top=0
or Projects/count

as I saw on some blogs.
But it didn't work

Please assist...

Function import doesn't work with with java classes in OSGi

The code which is described in tutorilal https://github.com/SAP/olingo-jpa-processor-v4/blob/develop/jpa-tutorial/Tutorials/Metadata/1-8-Functions.md doesn't add function import to metadata.
Here is the code:
EntityManagerFactory emf = JPAEntityManagerFactory.getEntityManagerFactory(PUNIT_NAME,ds); EntityManager em = emf.createEntityManager(); JPAODataCRUDHandler handler = new JPAODataCRUDHandler(PUNIT_NAME); handler.getJPAODataContext().setTypePackage("mypackage.functions"); handler.getJPAODataContext().initDebugger(PUNIT_NAME); handler.process(req, resp, em);

Productive usage

Hi everyone,
are there any plans to do a maven release build for productive usage? I like to create a new SAP Cloud Platform App using this framework to generate an OData Service based on our JPA Model. The OData Service shall be consumed by SAP Fiori / UI5.

Thanks in advance,
Alex

filter contains not working with SQL server

Hi,

I have a SQL Server up and running. I am somehow able to connect to that OData interface, but my API is creating filters similar to this: "$filter=contains(Name, '3') eq true"
This does result in very weird SQL queries (see below) which result in an SQL exception, because SQL Server is not capable to run them. The same does work on MySQL, but as being said, we are using SQL Server... Is there any way to deal with that?

SELECT NAME FROM STRATEGY WHERE (NAME LIKE ? = ?) LIMIT ?, ?
    bind => [%3%, true, 0, 201]

$filter pushed down to SQL or executed in the library?

  1. Is the $filter added to the SQL so that the database providing the data can process it?

Or

  1. Does the database return ALL data and then the $filter is processed in your code?

Because if #1 is the answer then the operation is exceedingly slow for large tables. I have table of about 1.8 million rows and I want to $filter out 50. That would be quick inside my Oracle database (due to indexes) but would take forever if all 1.8 million rows get loaded into my Tomcat server.

How does it work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.