title: Composite Primary key in JPA EclipseLink DynamicPersistence
body: <p>Eclipselink Dynamic Persistence allow multiple primary key by <strong>:</strong> <code>DynamicTypeBuilder.setPrimaryKeyFields(String primarykeysField...)</code></p>
  
  <p>But how can i find entity object(instance) by <strong><code>EntityManager.find( Entity Class , Object primaryKey)</code> method to find entity in case of composite primary key</strong>(Multiple Primarykey) (because of no IdClass or EmbeddedId) <strong>in Dynamic Persistence</strong> .</p>
  
  <p>EclipseLink take List of pk in the find() operation but if composite pk key defined in example -</p>
  
  <hr>
  
  <pre><code>Entity = Person
  Fields = username,emailId,firstName,lastName
  Composite PK = username,emailId
  </code></pre>
  
  <hr>
  
  <pre><code>Class&lt;?&gt; clazz = new DynamicClassLoader(Thread.currentThread().getContextClassLoader()).createDynamicClass("Person");
  DynamicTypeBuilder builder = new DynamicTypeBuilder(clazz, null, "Person");
  DynamicType dynamicType = builder.getType();
  builder.setPrimaryKeyFields(["username","emailId"]);
  builder.addDirectMapping("username",String.class,"username");
  builder.addDirectMapping("emailId",String.class,"emailId");
  builder.addDirectMapping("firstName",String.class,"firstName");
  builder.addDirectMapping("lastName",String.class,"lastName");
  
  List list = new ArrayList();
  list.add(${username}); //Run time value
  list.add(${emailId}); //Run time value
  </code></pre>
  
  <p>then <strong><code>EnitityManager.find(dynamicType.getJavaClass(),list)</code></strong> will take these arguments , am i right?
  If i am assuming correct then how will <code>EnitityManager.find()</code> operation will know that List 1st argument is username or emailId pk value (means sequence of composite pk fields value) instead of Map <code>({username:${username},emailId:${emailId}})</code> or other DataStucture .</p>