I am using spring 3.0.6, jpa 2.0, sleep mode 3.6.8. My question is: in what situations is javassist used to create a "proxy" for EntityClass? And what is the reason for this proxy? I have the following Entity:
@Entity
public MyEntity{
..
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "adresseID")
private Adresse adresse;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "myEntity")
private List<Parameter> parameters;
..
}
When I load MyEntity from db, the object class is something like MyEntity __ $$ _ javassist. Why is this done? What for? I think that only the regular MyEntity class can be used here.
To implement lazy loading, we can:
- for @OneToMany - here you can use the PersistenceBag.
- for @ManyToOne - use "enchancedClass" here, for example, the address _ $$ _ javassist
, MyEntity? - ? // ?