1

I'm using cglib for generating POJO-Classes to map hibernate-xml-files. I'm reading from the hibernatefiles to create classes. In Create simple POJO classes (bytecode) at runtime (dynamically) there is described how to generate these classes. but how to generate those classes that use a class that will be generated after the usage of the Type? So e.g.

public class Store{
    private int id;
    private String name;
    private StoreDetails details; // Class not found!

    //getters and setters
}

public class StoreDetail{
    private Store store; //my id as foreign key - Class is found, everything is fine
    private String detail1;
    private int detail2;

    //getters and setters
}

So class StoreDetail can use an attribute from type Store, but Store cannot use an attribute from type StoreDetail. StoreDetail is created after Store. Or is there any workaround? Other suggestions?

Community
  • 1
  • 1
Matthias Burger
  • 5,549
  • 7
  • 49
  • 94
  • ... why not just use Hibernate for what it is designed and let it handle the proxy generation OR the one-time class instrumentation itself? The Hibernate documentation should explain how. – Gimby Feb 21 '14 at 10:20
  • why downvote? question is neither unclear nor not useful. I've asked for other suggestions ;) Thanks, I'll check it :) – Matthias Burger Feb 21 '14 at 10:34
  • Don't pay it too much attention, downvoting is something that happens really quickly on this site. Start to worry when you get downvoted 3-4 points. – Gimby Feb 21 '14 at 11:48

0 Answers0