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

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

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

[OLINGO-76] determine the Temporal Type of a JPA property even if the
property is defined in the Parent Entity/non-entity.

And

Use the reflection method getField instead of getDeclaredField to access
the inherited JPA properties.

> @MappedSuperclass
> -----------------
>
>                 Key: OLINGO-76
>                 URL: https://issues.apache.org/jira/browse/OLINGO-76
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 1.0.0
>            Reporter: Thiago Assis
>            Assignee: Chandan V.A
>         Attachments: AbstractEntity.java, ExternalUser.java, 
> ExternalUserProvider.java, InternalUser.java, InternalUserPassword.java
>
>
> When i use @MappedSuperclass i got the error below:
> Caused by: java.lang.NoSuchFieldException: creationDate
>       at java.lang.Class.getDeclaredField(Class.java:1938)
>       at 
> org.apache.olingo.odata2.processor.core.jpa.access.model.JPATypeConvertor.convertToEdmSimpleType(JPATypeConvertor.java:83)
>       ... 75 more
> I suppose this is an error because the method 
> olingo.odata2.processor.core.jpa.access.model.JPATypeConvertor.convertToEdmSimpleType
>  should not use getDeclaredField (), but getFields () to search also the 
> attributes of the parent class.
> try {
>         if ((currentAttribute != null)
>             && 
> (currentAttribute.getDeclaringType().getJavaType().getDeclaredField(currentAttribute.getName())
>                 .getAnnotation(Temporal.class).value() == TemporalType.TIME)) 
> {
>           return EdmSimpleTypeKind.Time;
>         } else {
>           return EdmSimpleTypeKind.DateTime;
>         }
>       } catch (NoSuchFieldException e) {
>         throw 
> ODataJPAModelException.throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()),
>  e);
>       } catch (SecurityException e) {
>         throw 
> ODataJPAModelException.throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()),
>  e);
>       }



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to