valchkou / cassandra-driver-mapping

JPA addon for DataStax Java Driver for Cassandra
58 stars 24 forks source link

EntityTypeParser doesn't parse field properly if the field type and setter parameter type doesn't match #46

Closed manzar03 closed 9 years ago

manzar03 commented 9 years ago

Our entity classes are generated by Avro, and when avro generates the class for primitives defined in the avro schema the field in the class is kept as primitive but the getters and setters are boxed. Something like this:

class Test {
    private int val;

    public Integer getVal() {
        return val;
    }

    public void setVal(Integer val) {
        this.val = val;
    }
}

When we upgraded to the latest version of your library(2.1.4) we started seeing the EntityMetadata objects were missing these kind of autoboxed fields. Digging a bit deeper seems like there was a recent change where you added the check for type in: EntityTypeParser.isSetterFor method:

if(method.getParameterTypes()[0] != field.getType()) return false)

So is it possible for you to handle cases like these where primitive fields have boxed getters and setters?

valchkou commented 9 years ago

looking into it

valchkou commented 9 years ago

fixed

manzar03 commented 9 years ago

Hi,

Can you release a new version with this fix?

valchkou commented 9 years ago

This change was released on Jan 8. Still not working to you? or did you reload lib at all?