Skip to content

Mapping nested class #84

@STValeo

Description

@STValeo

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions