1 Reply Latest reply: Sep 20, 2011 6:05 AM by gimbal2 RSS

    Copying properties of one type of object to another type of object

    889280
      Hi All,

      I am trying to copy fields from DAO object to VO object.

      I have 3 choices below:
      1) through reflection
      2) use xml.
      3) manual copy through setter/getter

      I have tried some third party tools(like DOZER) to convert one type object to another type, manual copy is giving better performance compares with DOZER.

      Please give me a good solution.

      Thanks in Advance..!
        • 1. Re: Copying properties of one type of object to another type of object
          gimbal2
          If you want the best of both worlds there is basically only one way to go: use one object only so you don't need to copy around data. If this is possible is up to your application design (and maybe some programming rules you have to follow).

          If you must have the separate layers, it is speed VS ease of programming. Manual copying is lots of work but fast, any other solution will involve reflection one way or another and will have overhead. If you have to process hundreds of thousands of objects this way the overhead can be a killer, if you are limited to thousands of objects I wouldn't worry about it too much.