gora-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Mora (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GORA-538) No content stored for an object field with name "value"
Date Sun, 12 May 2019 05:27:00 GMT

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

John Mora commented on GORA-538:
--------------------------------

Hi.

I have been trying to reproduce this issue and it seems that it is related with auto-generated
classes from Avro, specifically in the implementation of the method #put(int field, Object
value) of the abstract class org.apache.avro.specific.SpecificRecord.
This is an example of what is generated for a class which has a field called 'value'.
{code:java}
public void put(int field$, java.lang.Object value) {
    switch (field$) {
    case 0: value = (java.lang.CharSequence)(value); break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
{code}

Due there is not a 'this.' keyword for identifying the scope of the 'value' variable, the
field is never changed and therefore data from all datastores (not only for MongoDB) never
loads into the bean.

Do you guys know how these classes are generated and how to modify its mapping in order to
improve the scope definition of variables in the put() method?.


Regards,
John.

> No content stored for an object field with name "value"
> -------------------------------------------------------
>
>                 Key: GORA-538
>                 URL: https://issues.apache.org/jira/browse/GORA-538
>             Project: Apache Gora
>          Issue Type: Bug
>          Components: gora-mongodb
>            Reporter: Clément Garbay
>            Priority: Major
>
> When I have a field called "value" in a Java object, no content is stored for this field
in MongoDB.
> I came accross this problem when I stored a raw object in a field declared with type
`list` in class using the Gora ORM.
> It seems that the problem appears with reserved Java keywords.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message