cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi Experts!

In my organization we've developed a java application that exposes odata services, some technologies that we've used are:

  • Spring Boot
  • Apache Olingo
  • JPA/Hibernate

Everything seems to work fine, we can consume the odatas and do our requirements, but I've found a problem when performing a filter by date.

Query:

WorkOrderHeaders?$filter=(StartDate ge datetime'2018-01-16T05:00:00')

Result:

QueryException: unexpected char: '{' [SELECT E1 FROM WorkOrderHeader E1 WHERE (E1.startDate >= {ts '2018-01-16 05:00:00.000'})]

I thought it was a problem of Olingo, so I did a research and found this article: https://issues.apache.org/jira/browse/OLINGO-240?jql=text%20~%20%22datetime%20filter%22

It basically said: "This issue is specific to hibernate and currently there is no specific handling in Olingo JPA processor for hibernate."

Googling about hibernate I've found this: https://hibernate.atlassian.net/browse/HHH-8653

It mention: "The root of the problem seems to be that the Hibernate generated grammar does not include support for temporal literals"

So, apparently hibernate don't provide support for date literals.

  • Any ideas how to solve this issue?.
  • Do I have to change JPA implementation?

ps. I've builded a small project using the same technologies but considering eclipselink instead of hibernate and it works fine with date filters.

0 Likes
View Entire Topic
Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi Ivan

Considering that you've made it work with EclipseLink, are there any reasons why you should be using hibernate instead?

BTW: SAP has delivers the library "SDK for Services" which is basically the same "logic" behind the new cloud foundry "application programming model". With both technologies you are able to create your own OData services based on a DB entities with automation and simplification of the development process without sacrificing flexibility. I'd suggest looking into it as well. There os a nice blog on how to create samples using this technologies.

Hope that helps.

Regards,
Ivan

Former Member
0 Likes

Hi Ivan.

Thanks for you answer, currently I'm testing the application looking for negative impacts because of the migration from Hibernate to EclipseLink.

Since our team has more experience working with hibernate, is there a way to fix this problem?