[ 
https://issues.apache.org/jira/browse/OLINGO-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13875101#comment-13875101
 ] 

ASF subversion and git services commented on OLINGO-45:
-------------------------------------------------------

Commit 1fc260e61aee0dba8d95d1e9a50957bf01218138 in branch refs/heads/master 
from [~chandan.v.a]
[ 
https://git-wip-us.apache.org/repos/asf?p=incubator-olingo-odata2.git;h=1fc260e 
]

[OLINGO-51] - Full support for Inserting an Entity and creating a link
using the <link> tags part of OData entry.
[OLINGO-49] - Handle Links
[OLINGO-45] - Ignore inline entries in case of HTTP PUT. However only
update the links.



Signed-off-by: Chandan V A <[email protected]>

> ClassCastException on Entity update
> -----------------------------------
>
>                 Key: OLINGO-45
>                 URL: https://issues.apache.org/jira/browse/OLINGO-45
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 1.0.0, V2 1.1.0
>            Reporter: Georgi
>            Assignee: Chandan V.A
>             Fix For: V2 1.1.0
>
>
> You might want to doublecheck the logic in 
> org.apache.olingo.odata2.processor.core.jpa.access.data.JPAEntity:write(final 
> Map<String, Object> oDataEntryProperties, final boolean isCreate)
> On line 141 there's an explicit cast to List<ODataEntry>. However I found out 
> that during update, when the property is a 1:1..0 relation to another Entity, 
> the returned type is ODataEntry. And that causes the ClassCastException.
> I managed to solve this for me with a simple if/else block:
> List<ODataEntry> relatedEntries = null;
> if(oDataEntryProperties.get(propertyName) instanceof ODataEntry){
>         relatedEntries = new ArrayList<ODataEntry>();
>         
> relatedEntries.add((ODataEntry)oDataEntryProperties.get(propertyName));
> } else {
>         relatedEntries = 
> (List<ODataEntry>)oDataEntryProperties.get(propertyName);
> }
> The code is from the 1.1.0-SNAPSHOT master branch HEAD.
> I hope that helps.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to