Ruslan Stelmachenko created OLINGO-245:
------------------------------------------
Summary: Wrong EDM property type when setDefaultNaming is false
Key: OLINGO-245
URL: https://issues.apache.org/jira/browse/OLINGO-245
Project: Olingo
Issue Type: Bug
Components: odata2-jpa
Affects Versions: V2 1.2.0
Reporter: Ruslan Stelmachenko
Attachments: apache-olingo-tutorial.zip
If I set {{ODataJPAContext.setDefaultNaming(false)}} then simple request stop
working:
http://localhost:8080/olingo.odata2.sample.cars.web/MyODataJPA.svc/Productss
with this error:
{quote}
java.lang.ClassCastException
org.apache.olingo.odata2.core.edm.provider.EdmSimplePropertyImplProv cannot be
cast to org.apache.olingo.odata2.api.edm.EdmNavigationProperty
org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator
createNavigationInfoObjects 383
{quote}
*The problem in ManyToOne fields.*
I debug a little and realized that method
{{org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator.createNavigationInfoObjects}}
receiving {{propertyNames}} list with propery names that already in
{{edmProperties}} as {{EdmSimplePropertyImplProv}}. But if I set
{{ODataJPAContext.setDefaultNaming(true)}} then the same method receiving list
with navigation propery names as *JpaEntityClassNameDetails* so the names are
different and all working fine.
I dont know how to fix this but because of this behavior we can't just use
{{ODataJPAContext.setDefaultNaming(false)}} for ManyToOne fields.
I attach a simple maven project with my Entities and simple servlet for run in
tocmat. Problematic entity is {{Products}}.
--
This message was sent by Atlassian JIRA
(v6.2#6252)