jpenninkhof / odata-boilerplate

OpenUI5 boilerplate based on OLingo, JPA and Spring Boot
MIT License
82 stars 41 forks source link

JPA problem with primary key of type string #10

Closed mjza closed 4 years ago

mjza commented 4 years ago

When I make a table with primary key of type string then I can only read all the items inside the set, or create a new item. But I cannot read a single item with its id, or delete or update it!

https://stackoverflow.com/questions/62081165/jpa-has-problem-with-tables-entities-with-primary-key-of-type-string

It seems the code has a problem. I cannot even filter string columns. For example for the following url I see this error on the original code:

http://localhost:9090/odata.svc/Members?$format=json&$filter=FirstName eq 'Jack'

{
    "error": {
        "code": null,
        "message": {
            "lang": "en",
            "value": "org.hibernate.exception.SQLGrammarException: could not extract ResultSet"
        }
    }
}
mjza commented 4 years ago

@jpenninkhof How can I add custom restriction class to the application? If you have time please take a look here:

https://andy722.wordpress.com/2014/04/07/escaping-special-characters-in-hibernate-queries/

or

https://stackoverflow.com/questions/673508/using-hibernate-criteria-is-there-a-way-to-escape-special-characters/1111801#1111801

mjza commented 4 years ago

I must add that I have updated the libraries versions as follow:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
        <cxf.version>3.3.6</cxf.version>
        <olingo.version>2.0.11</olingo.version>
    </properties>

and this is the source of the problem.

mjza commented 4 years ago

@jpenninkhof Maybe not a bad idea to try upgrade the libraries and solved the issues if you like. I couldn't find a solution.