SAP / olingo-jpa-processor-v4

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.
Apache License 2.0
122 stars 76 forks source link

Expand Functionality is not working on jpa processor for version 1.0.9 #218

Open keshavsahu10 opened 11 months ago

keshavsahu10 commented 11 months ago

As we have upgraded jpa processor to 1.0.9, expand functionality is not working but same is working with 1.0.8

wog48 commented 11 months ago

Can you give an example what is not working. In case you get an error message, can you provide the error?

There is set of integration tests for $expand, which where green, so I assume that there your case is missing.

keshavsahu10 commented 11 months ago

Odata Query : /Workers?$expand=Title Both Worker and Title related to eachother by OneToOne,

Error : getProcess : URL - /zip/odata/Workers , Query string - $expand=Title 2023-07-24 18:59:10.832 WARN 25528 --- [http-nio-8988-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 169, SQLState: S0001 2023-07-24 18:59:10.834 ERROR 25528 --- [http-nio-8988-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : A column has been specified more than once in the order by list. Columns in the order by list must be unique.

wog48 commented 11 months ago

One additional question:

If you look at generated SQL statement in the logs, does it also contain duplicates in the Select clause?

keshavsahu10 commented 10 months ago

select distinct title1_.[LongDescription] as col_00, title1_.[TitleId] as col_10, title1_.[Code] as col_20, title1_.[ShortDescription] as col_30 from [tx].[viWorker] worker0 inner join [tx].[Title] title1 on worker0.[TitleId]=title1.[TitleId] where worker0.[WorkerId]>=1 and worker0.[WorkerId]<=1000 **order by title1.[TitleId] asc, title1_.[TitleId] asc;**

keshavsahu10 commented 10 months ago

In order by clause it's duplicate

wog48 commented 10 months ago

Actually, I'm not able to reproduce this. The OrderBy clause is created in JPAAbstractExpandQuery#createOrderByJoinCondition. Looking at the code, I assume that there is problem with the metadata generation. Is it okay to provide the code of entity _viWorker?

keshavsahu10 commented 10 months ago

Yes we can , but actually _viWorker is an view not entity, we are making use of view instead of entity as per our requirement, but same thing is working in 1.0.8 version.

wog48 commented 10 months ago

It should not make a difference is your jpa entity based on a view or a table.