Code:
public class User {
...
private Address address;
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
...
}
public class Address {
private String addressId ;
....
}
and User's address is lazy now.
How can I dynamic create a lazy proxy instance (address) , the proxy can also be persiste in session . just like :
Code:
User user = (User) session.load(User.class, "1");
Address address = ....//dynamic create a lazy proxy by Class and idValue
user.setAddress(address);
Session session = openSession();
session.update(user);
session.close();
....