wisdom-framework / wisdom-orientdb

Wisdom OrientDB integration
Apache License 2.0
2 stars 3 forks source link

Model attribute beginning with "_" leads to a NULL value #23

Open segalaj opened 9 years ago

segalaj commented 9 years ago

Problem Get the value of an element attribute named _ return always NULL

How to reproduce Create a model like:

@Entity
public class Test {
    @Id
    private String id;

    private Date _date;

    public Test() {
    }

    public String getId() {
        return id;
    }

    public Date getDate() {
        return _date;
    }

    public void setDate(Date date) {
        this._date = date;
    }
}

Try to access to an element in a controller:

....
    @Model(value = Test.class)
    private OrientDbCrud<Test,String> _testCrud;
....
    @Route(method = HttpMethod.GET, uri = "")
    public Result test() {
        return ok(Iterables.toArray(_testCrud.findAll(), License.class)).json();
    }

Return:

[{"id":"#18:0","date":null,"handler":{}}]

Environment Java 8, wisdom 0.7.0, wisdom-orientdb 0.2.4, orientdb 2.0.2

barjo commented 9 years ago

Hi,

I can reproduce it on the snapshot version. It seems that it's a limitation of orientdb itself (or possibly javassist). We should consider opening the issue on their tracker https://github.com/orientechnologies/orientdb/issues

segalaj commented 9 years ago

Hi, thanks for your answer. I'm not sure that come from oriendb, in fact it's possible to have column name beginning with "_" in one table.

What do you think?

cescoffier commented 9 years ago

Hi,

It may come from the proxy generation that orientDB is doing.

2015-03-26 13:38 GMT+01:00 Joachim Segala notifications@github.com:

Hi, thanks for your answer. I'm not sure that come from oriendb, in fact it's possible to have column name beginning with "_" in one table.

What do you think?

— Reply to this email directly or view it on GitHub https://github.com/wisdom-framework/wisdom-orientdb/issues/23#issuecomment-86493737 .

barjo commented 9 years ago

Indeed, I am pretty sure it's related to the JPA layer of orientdb. I will check with them and open an issue if that's the case.

barjo commented 9 years ago

After further investigation it seems that it is because the field name does not match the getter/setter. https://github.com/orientechnologies/orientdb/blob/master/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectMethodFilter.java

barjo commented 9 years ago

I open an issue at orientdb https://github.com/orientechnologies/orientdb/issues/3822

segalaj commented 9 years ago

Thanks a lot for your investigation.

barjo commented 9 years ago

It seems it will be fix for orientdb 2.2