Marking an ObjectContext as "done, don't use"

Hugi Thordarson <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hi all,
i'm looking for suggestions on an approach to mark an ObjectContext as "obsolete", i.e. to explicitly state that I'm now done with it and any further operations on it (preferably even any objects in it) signify a logical error/bad state.

First thought is to create my own DataContext subclass with a simple boolean marker, and override methods like commitChanges() and onQuery() to throw an exception if the marker is set. At least that provides partial safety. But I'm wondering if anyone has suggestions for a better approach?

Cheers,
- hugi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.