I am using spring 3.0.6, jpa 2.0, hibernate 3.6.8. My question is, in which situations is javassist used to create "proxy" for a EntityClass? And what is reason of this proxy? I have the following Entity:
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "adresseID")
private Adresse adresse;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "myEntity")
private List<Parameter> parameters;
When I load a MyEntity from db, the class of entity is something like MyEntity__$$_javassist. Why is it done? What for? I think that just regular class MyEntity can be used here .
To implement lazy loading, we can:
- for @OneToMany - PersistenceBag can be used here
- for @ManyToOne - here should be used "enchancedClass" like Adress_$$_javassist
So what is reason for enchancing MyEntity? Where I can read something more about it? Which book/article/blog can you recommend me?