I was trying to understand how hibernate work in the sense that how putting @Entity on a class makes it a persistent class ? i.e
@Entity
class A{
private int b;
public int getB(){
return b;
}
public void setB(int b){
this.b = b;
}
}
behaves like below written class at runtime
class A{
private int b;
public int getB(){
return (SQL code to fetch b from DB)
}
public void setB(int b){
(SQL code to set b in DB)(b);
}
}
If we say it is using reflection then how it is changing the code that is inside the methods ?