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

Mapping nested class #84

Open STValeo opened 6 years ago

STValeo commented 6 years ago

Hi there I've started to use jmapper recently and I'm just wondering if it's possible to do what I'm trying to do ahah

`------------ SRC FOLDER ------------------------------


public class Container
{
    private Subscription subscription;
}

@Entity
public class Subscription
{
    @Id
    @JMap
    private String subscriptionUid;

    @ManyToOne("service_uid")
    private Service service;
}

@Entity
public class Service
{
    @Id
    @JMap
    private String serviceUid;

    @JMap
    private String serviceName;

}

-----------------------------------------------------
---------------- DESTINATION FOLDER -----------------

public class Foobar
{
    @JMap
    private String service_name;

    @JMap
    private String subscription_uid;
}

public class ResponseDto
{
    private Foobar suscription;
}

---------------------------------------------------

actual output with an object with following:
SOURCE AS =====>
Container
{
    subscription class Subscription
    {
        subscription_uid = "9843-324872-98273";
        service class Service
        {
            service_uid = "876876-998798-987987";
            service_name = "myServiceName"
        }
    }
}

AND DESTINATION IS

ResponseDto
{
    suscription class Foobar
    {
        subscription_uid = "9843-324872-98273"
        service_name = null
    }
}`

How's that possible ? why my nested class property are not mapped inside the destination ? Did I need to annotate something else ?

anyone can tell me why during mapping to destination why my property is not filled as well as this property is inside a nested class in the source
thanks :)