title: Best practices of making object converter
body: <p>I've faced a problem that can not solve by myself, thus, I'm asking for your help. The problem is following:
  We have to upgrade persistence layer. Previously project used JDBC to access data, but now it should use JPA. It means that now data is retrieved in new objects, but system works with old ones. Thus, we should write some converters between old and new entities. But the problem is that sometimes to form new entity from old one we need some additional info. For example:</p>
  
  <pre><code>class OldEntity{
      private int id;
      // old entity contains only foreign key
      private int otherEntityId;
      ...
  }
  
  class NewEntity{
      private int id;
      // new entity contains object that associated with foreign key
      private OtherEntity otherEntity;
      ...
  }
  </code></pre>
  
  <p>We want to add some general interface to all converters, but if we convert from old entity to new one, firstly, we should retrieve "otherEntity" by its id and give it to the converter. As we have a lot of entities with different structures, converter's method should recieve various number of different parameters to form new entity.
  The question is: is there any good architecture solution for such problem?   </p>