4.2. Finding Out about an Object's State

The previously mentioned seven states transient, persistent-new, persistent-new-deleted, hollow, persistent-clean, persistent-dirty, and persistent-deleted are mandatory for all JDO implementations, although there is no API to get the internal state of an instance used within the JDO implementation. The exact state of a JDO instance is known only by the JDO implementation, and some states might not even be implemented by some vendors. The JDO states are defined in a behavioral manner. Nevertheless, some methods let us interrogate the persistence attributes coupled with the object and find information about the object's state.

These static methods are in the JDOHelper class:

 boolean isDeleted(Object o) ...

Get Core Java™ Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.