Is that possible to create a dynamic "where" jpa (persistance layer) query with getting from filtered uı data (Service layer)
Asked
Active
Viewed 436 times
0
-
Look at [JPA Criteria API](https://docs.oracle.com/javaee/6/tutorial/doc/gjitv.html). – vanje May 17 '18 at 13:35
-
Yes, that is possible. Using Criteria in a jpa query is a topic that's well covered by both docs and tutorials. Do you have a specific question? – f1sh May 17 '18 at 13:46
-
I have different entities and properties and I do not know execute query which filter properties and entity sending from user I had looked up that api it is not useful for me. – xabozden May 17 '18 at 13:47
-
also ı am using odata olingo framework which is building string query filter that is the main problem.how does the jpa understand it ? – xabozden May 17 '18 at 14:03
1 Answers
0
The easiest way to implement Apache Olingo's ExpresionVisitor
for OData filtering is to use HQL (Hibernate Query Language). Take a look at the repository where I did it. The trick is to map somehow OData's Entities and their properties to the ones from Hibernate.

mat3e
- 781
- 5
- 17