title: Suggestions on solving a JPA persistence issue
body: <p>I'm building a persistence tester. This project is responsible for creating and populating (with random values) any other object I might have. An object (obj1) is persisted in a DB and then read from it and stored (obj2), then I'll compare them (obj1 == obj2). To test if the data is persisted correctly. (Up to this point with simple objects, this is already working)</p>
  
  <p>However, since I'm populating all the objects with random values I have a problem because the id's are random...
  This makes it impossible to persist because FK's aren't corresponding to any id's.</p>
  
  <p>To fix this, I was thinking of building a Factory for each object (and there are a lot of objects) and save the id's so that later, when persisting I could just get the id value and use it accordingly. However I have no guarantee this will work, you guys think so?</p>
  
  <p>Have you guys had this kind of problem? How did you solved it? Do you have any other suggestions? They are much appreciated.</p>
  
  <p>Thanks</p>