title: Byte Buddy Runtime generation for spring boot JPA repository classes
body: <p>I am using <strong>Byte Buddy</strong> to generate JPA entities and JPA repository. I am able to generate the JPA entities but not able to proceed in generating corresponding JPA repositories. Following is the code which represent Person entity,</p>
  
  <pre><code>import javax.persistence.*;
  @Entity
  public class Person {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      protected Person(){}
  
      @Override
      public String toString() {
          return String.format("Person[id=%d]",id,name);
      }
  }
  </code></pre>
  
  <p>I am able to generate the above using Bute Buddy as follows,</p>
  
  <pre><code>Class&lt;?&gt; type = new ByteBuddy()
      .subclass(Object.class)
      .name("Person")
      .defineField("id", Integer.class, Visibility.PRIVATE)
      .defineMethod("getId", Integer.class, Visibility.PUBLIC)
      .intercept(FieldAccessor.ofBeanProperty())
      .defineMethod("setId", void.class, Visibility.PUBLIC).withParameter(Integer.class)
      .intercept(FieldAccessor.ofBeanProperty())
      .make()
      .load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER)
      .getLoaded();
  </code></pre>
  
  <p>Now I would like to generate corresponding Spring boot Jpa reporitories as below,</p>
  
  <pre><code>import com.model.Person;
  import org.springframework.data.jpa.repository.JpaRepository;
  
  public interface PersonRepository extends JpaRepository &lt;Person, Long&gt; {
  
  }
  </code></pre>
  
  <p>How to create this interface with Generic attribute. Also will this work (using dynamic code generation) to persist Person object?</p>