Good evening,
I have a Java Application running on a Tomcat 8 Server, with JPA v. 2.1 and
Hibernate 5.2.5.
I'm using Apache Olingo JPA v. 2.0.10.
I have an OData entity model whose service metadata document description is
as follows:
In a create operation, the String primary Keys (BusinessSectorId,
DistributionCenterId, SalesOrganizationId) have to be included manually, but
the PartnerId key is generated automatically.
So, essentially, I have a entity with four primary Keys (three of them are
of type String and one of type Long). I can successfully create a Partner
entity, but when I try to read/update/delete the recently created Partner,
it fails, returning me a 404 status code with a "Requested entity could not
be found" message.
There is an exception to this case though: when the String primary Keys have
the same value (e.g.: "BusinessSectorId='02'","DistributionCenterId='02'"
and "SalesOrganizationId='02'"), the read/update/delete operations work as
expected.
Below there are some test scenarios which illustrate the problem. Assume
that the entities that I'm trying to read already exist in my DB.
Test Scenario 1: Different values in those 3 keys. Server Returns HTTP 404.
Request URL:
http://localhost:8080/sfa-mvp/api/Partners(BusinessSectorId='4',Distribution
CenterId='41',PartnerId=10L,SalesOrganizationId='0101')
Server Response Body:
http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";>
Requested entity could not be found.
Test Scenario 2: Equals values in those 3 keys. Server Returns HTTP 200 with
the requested Entity in the Response Body.
Request URL:
http://localhost:8080/sfa-mvp/api/Partners(BusinessSectorId='09',Distributio
nCenterId='09',PartnerId=11L,SalesOrganizationId='09')
Server Response Body:
http://www.w3.org/2005/Atom";
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"xml:base="htt
p://localhost:8080/sfa-mvp/api/">
http://localhost:8080/sfa-mvp/api/Partners(BusinessSectorId='09',Distributio
nCenterId='09',PartnerId=11L,SalesOrganizationId='09')
Partners
2018-05-02T14:00:59.366-03:00
http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
09
12345673
09
Wesley3
11
09
ZKR4
This problem has completely stopped my development team and we have an
important deadline coming that depends on this feature working properly, so
an answer to this would be greatly appreciated.
With regards, Wesley.
http://www.itsgroup.com.br/assinaturadeemail/Logo_ITS_2.png
Wesley Rosa
Java Developer
+55 51 99882-3675 | +55 51 3206-1714
wesley.r...@itsgroup.com.br
http://www.itsgroup.com.br/assinaturadeemail/SAPGoldPartner.png
<http://www.itsgroup.com.br/> www.itsgroup.com.br
<https://www.facebook.com/itsgrouprs/> Facebook |
<https://www.linkedin.com/company/its-group> LinkedIn