Hi all,

we have a problem with closed persistence brokers. Maybe it is selfmade. I
just would like to have your opinion.

First the symptoms:

From time to time I get NullPointerExceptions in
PersistenceBroker.getTopLevelClass() and
PersistenceBroker.getClassDescriptor(Class clasz). Both are caused by
PersistenceBroker instances that are closed and whos internal
descriptorRepository is null.

In fact, we always call PersistenceBroker.close() after each "transaction"
and obtain new Instances for further operations (I do not really remember
why we do this, but I guess it was suggested to do so somewhere in the
tutorials). The problems now occurrs when materializing collection or
reference Proxies, where unfortunately we are unable to intervene.

As a very dirty workaround, we use our own PB implementation extending
PersistenceBrokerDefaultImpl. We make sure that the descriptorRepository
variable is always accessed through a getter, that checks whether the PB is
closed and calls setClosed(false) if it is. The problems disappeared, but
I'm afraid, this may cause other problems as I do not know what effects
closing a PB and calling setClosed(false) afterwards has.

Could anyone tell me whether this workaround is safe and what could be a
gould strategy to avoid these kind of problems? Is it really necessary to
close PBs all the time?

Thanks,

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to