O'Reilly logo

Core Java™ Data Objects by Heiko Bobzin, Michael Vorburger, Keiron McCammon, Sameer Tyagi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.6. Putting It All Together

The following code excerpts show how to use the state interrogation methods and instance callbacks to debug common problems. A class is developed that serves as a helper to find out about the actual state of objects, number of objects in memory, objects per state, and so on. Because most JDO vendors don't provide methods to get information about a PersistenceManager's in-memory cache, it is quite handy to have a vendor-independent debug facility.

All the following methods can be found in the DebugStates.java source file.

The first method is a helper to get the memory ID of an object. A simple way to get an informal ID of an object is to call identityHashCode. Although this is not a unique ID, it works on common virtual ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required