jmapper-framework / jmapper-core

Elegance, high performance and robustness all in one java bean mapper
http://jmapper-framework.github.io/jmapper-core
Apache License 2.0
227 stars 41 forks source link

ClassNotMappedException with super class mapped #18

Closed gcamaraomarques closed 9 years ago

gcamaraomarques commented 9 years ago

I'm using RelationalJMapper in my Spring Boot Project, and I have this classes. using your example names to help understanding

class PivotI extends AbstractPivotI {
    // no attributes on this class
    // methods
}

class abstract AbstractPivotI {
    Integer id;
}

class BoI extends AbstractBoI {
    // no attributes too
    // some methods
}

class abstract AbstractBoI {
    @JMap(attributes={"id"}
          classes   ={PivotI.class })
    Integer boIfield;
}

class Magic {
    public void whereTheMagicHappens() {
        //some magic code 
        PivotI source = new PivotI(1);
        RelationalJMapper<BoI> mapper = new RelationalJMapper<BoI>(BoI.class);
        BoI destination = mapper.manyToOne(source);
        //more magic code
    }
}

When I try to use the method whereTheMagicHappens the RelationalJMapper.init() throws a ClassNotMappedException.

I'm not sure if it's a problem to you, but to use your mapper I added a attribute never used in both classes and annotated with @JMap.

Thanks for the mapper it's helping alot and if you need any information to help just ask.

avurro commented 9 years ago

The issue is in the method isMapped in Annotation class, super class aren't checked, i will fix it as soon as possible. I'm sorry for the inconvenience

avurro commented 9 years ago

Now you can download the last release tha fix this issue, sorry for the inconvenience.

gcamaraomarques commented 9 years ago

Thank you for the fast solution. And thanks for the great mapper.

avurro commented 9 years ago

Thanks for your support, these are incentives that push me to go ahead :)