I am wondering if it is possilbe to force an object that is set to lazy load to load after it has been detached. Basically what we have is Object A has an instance of Object B. In a some clients we want B, but in most we don't. I would like to be able to set A to lazy load B, but the problem is the client that wants B does not have a connection to the database. So we would like to return A through a DAO then have another method in the DAO that can force A to load B. Here's an example, what I can't figure out is what should be inside the fullyLoadedA method.
Thanks for all advice
Jason
Code:
A.java
CODE
@Entity
public class A {
...
private B myB;
@OneToOne
public B getMyB() {
return myB;
}
...
}
Code:
B.java
CODE
@Entity
public class B
...
}
Code:
ADAO.java
CODE
public class ADAO {
...
//this should use lazy loading
public A findById(Aid id){ ... }
//at some point call this to load
public A fullyLoadedA(A a){
//somehow force A to load all of its lazy objects and return it?
}
...
}
Jason