Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. I have a source class Entity having some params and a target class Dto class.
  2. Now, Entity class is having params of some other class but in dto class i'm using those params directly not using the other class referene in dto.
  3. Problem is : while doing BeanUtils.copyProperties(source,target) those properties having reference to other class doeesnot get copies to dto class.
  4.  
  5. Public class Entity{
  6. private A a;
  7. private String add;
  8. }
  9. Public class A{
  10. private String name;
  11. }
  12. Dto class :
  13. public class Dto{
  14. private String add;
  15. private String name; // here instead of class A i directly took the param of class A as per requirement.
  16. }
  17.  
  18. How can i do
  19. BeanUtils.copyProperties(Entity,Dto);
  20. So that all properties get copied.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement