Hi the list !
After long investigation, my previous problem come from a proxy.
I have a collection of B in A. Using fetch plan, I removed B and get
back my A without B witch is good.
Somewhere, I have the following code :
This happen after the transaction is closed, I explicitly close the
entityManager when this code happen.
if (getB() != null) {
result = new B[getB().size()]; // It fail here on .size
int index = 0;
for (B b : getB()) {
result[index] = b;
index++;
}
}
This code fails when I called getB().size().
Because of the proxy (that's what I guessed) getB() is not null but
the data is not there because I removed it from the fetch plan.
getB() != null doesn't catch the case of "B not retreive due to fetch
plan".
That could be fine is getB().size() returned 0 but it failed on null
pointer exception !
The stack trace look like OpenJPA, because of proxy, try to get B from
the database but I don't want that, I want null that's why I remove B
from fetch plan, I don't want B.
If I want B, witch will happen in some other cases, I'll add B to the
fetch plan but that owuld be in totally different transaction and
business context.
Basically, the question could be how to get rid of proxy and get null
values, even if they are in the DB but I removed it from the fetch
plan so I "tell" to OPenJPA I know what I'm doing.
Is this possible ?