Deep Mapping

17 views
Skip to first unread message

anup...@cinesoft.live

unread,
Aug 13, 2018, 8:28:32 AM8/13/18
to Dozer Mapper
Hi there,
            I have a scenario where in I have to map an integer value from a DTO class to a @ManyToOne member of an Entity class.

i.e


DTO.java

{

private int id;

//GETTER & SETTER

}

Entity.java

{

private User user;

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn (name ="user", referencedColumnName="userId")
public Users getUser() {
     return user;
}

}

User.java

{

private int userId;

//Getter and Setter

}


dozer-mapping.xml

 <mapping map-null="false"  map-empty-string="false">
    <class-a>DTO</class-a>
<class-b>Entity</class-b>
<field>
  <a>id</a>
  <b>userId</b>
</field>
</mapping>



Kindly help me with this mapping. Thanks in advance

Gareth Healy

unread,
Sep 8, 2018, 4:23:48 AM9/8/18
to Dozer Mapper
Reply all
Reply to author
Forward
0 new messages