Wednesday, September 28, 2005
Want Gas for a Year? Fill up Now
From: "Gas Giveaway" <HTULH@mcdade.from.clickyourlife.com>
Reply-To: <HTULH@service.reply.clickyourlife.com>
Date: Wed, 28 Sep 2005 20:37:27 -0400
Subject: Want Gas for a Year? Fill up Now
http://afanasyev.clickyourlife.com/NjFZhzM7UYM6OVuDOjBZhzoyVoI2NFuPOjdZjzoyWYU4/
how JDO links the persistent object to its persistent state in the datastore. The Three Types of JDO Identity There are three flavors of JDO identity, and the JDO metadata associates each application data class with one of these flavors. The first two flavors, datastore identity and application identity, are called the durable JDO identities. As the name implies, the durable identity value is stored in the datastore. As would be expected, the datastore ensures that all durable identity values are unique. The third flavor of JDO identity is nondurable identity. As its name implies, its value is not stored in the datastore. Indeed, the purpose of nondurable identity is to avoid the overhead of storing unique identity values in the datastore. All of the application data classes that are related by inheritance to another application data class must use the same flavor of JDO identity as the least-derived application data class in its inheritance hierarchy. For example, if Truck and Car are application data classes that inherit from the Vehicle application data class, then the flavor of JDO identity used for Vehicle must also be used by Truck and Car. On the other hand, if Truck and Car inherit from Object instead, then they could use different flavors of JDO identity, because applications do not enhance the Object class. Every JDO implementation must support one of the two durable identity types. It may, at its option, support either or both of the other two identity types. Chapter 6 demonstrates how to determine the options that a particular implementation supports. Datastore Identity When datastore identity is used, the JDO implementation takes complete responsibility for managing the object identities for the application data class. The identity class is defined by the implementation, and the JDO implementation selects a mechanism for generating the identity values. As a result, the application programmer will find it convenient to use the datastore identity in many cases. Enhancement does not add any additional instance fields to the application data class to hold the datastore identity. Because the identity value is not stored in the application data object, the datastore identity value is opaque to the application data class. The application has no access to its type or value, except by reflection on the identity object. JDO does not permit the application to change the value of a datastore identity. Different implementations are very likely to have different datastore identity classes and use different algorithms for calculating the identity value. For that reason, it is not meaningful to compare the equality of datastore identity objects that come from different implementations. The JDO implementation may impose additional restrictions on when it is meaningful to compare the equality of datastore identities. For example, if the datastore reassigns identity values during reorganization, it is not meaningful to compare a datastore identity obtained before the reorganization with a datastore identity obtained after the reorganization. Although JDO gives implementations a free hand in the details of implementing the datastore identity class, any datastore identity class must meet the following seven requirements: § It must be public. § It must implement Serializable. § It must have a public no-argument (no-arg) constructor. § All of its instance fields must be serializable and public. § It must have a constructor that accepts one string. § Its toString method must return a string that can be passed to its string constructor, as well as to the persistence manager's newObjectIdInstance method, to obtain a new identity object that is equal to the original object from which the string was obtained. § Its equals method must return true if and only if the two datastore identity objects contain the same identity value, and its hashCode method must return the same integer value for different identity objects when they contain the same identity value. Two of the requirements on the list are especially interesting. First, the datastore identity object is serializable. Hence, it can be stored and passed to other JVMs. Second, the toString method returns a string that can be used to re-create the identity object. In this book, this string value is called the identity string. An identity string is v
Reply-To: <HTULH@service.reply.clickyourlife.com>
Date: Wed, 28 Sep 2005 20:37:27 -0400
Subject: Want Gas for a Year? Fill up Now
http://afanasyev.clickyourlife.com/NjFZhzM7UYM6OVuDOjBZhzoyVoI2NFuPOjdZjzoyWYU4/
how JDO links the persistent object to its persistent state in the datastore. The Three Types of JDO Identity There are three flavors of JDO identity, and the JDO metadata associates each application data class with one of these flavors. The first two flavors, datastore identity and application identity, are called the durable JDO identities. As the name implies, the durable identity value is stored in the datastore. As would be expected, the datastore ensures that all durable identity values are unique. The third flavor of JDO identity is nondurable identity. As its name implies, its value is not stored in the datastore. Indeed, the purpose of nondurable identity is to avoid the overhead of storing unique identity values in the datastore. All of the application data classes that are related by inheritance to another application data class must use the same flavor of JDO identity as the least-derived application data class in its inheritance hierarchy. For example, if Truck and Car are application data classes that inherit from the Vehicle application data class, then the flavor of JDO identity used for Vehicle must also be used by Truck and Car. On the other hand, if Truck and Car inherit from Object instead, then they could use different flavors of JDO identity, because applications do not enhance the Object class. Every JDO implementation must support one of the two durable identity types. It may, at its option, support either or both of the other two identity types. Chapter 6 demonstrates how to determine the options that a particular implementation supports. Datastore Identity When datastore identity is used, the JDO implementation takes complete responsibility for managing the object identities for the application data class. The identity class is defined by the implementation, and the JDO implementation selects a mechanism for generating the identity values. As a result, the application programmer will find it convenient to use the datastore identity in many cases. Enhancement does not add any additional instance fields to the application data class to hold the datastore identity. Because the identity value is not stored in the application data object, the datastore identity value is opaque to the application data class. The application has no access to its type or value, except by reflection on the identity object. JDO does not permit the application to change the value of a datastore identity. Different implementations are very likely to have different datastore identity classes and use different algorithms for calculating the identity value. For that reason, it is not meaningful to compare the equality of datastore identity objects that come from different implementations. The JDO implementation may impose additional restrictions on when it is meaningful to compare the equality of datastore identities. For example, if the datastore reassigns identity values during reorganization, it is not meaningful to compare a datastore identity obtained before the reorganization with a datastore identity obtained after the reorganization. Although JDO gives implementations a free hand in the details of implementing the datastore identity class, any datastore identity class must meet the following seven requirements: § It must be public. § It must implement Serializable. § It must have a public no-argument (no-arg) constructor. § All of its instance fields must be serializable and public. § It must have a constructor that accepts one string. § Its toString method must return a string that can be passed to its string constructor, as well as to the persistence manager's newObjectIdInstance method, to obtain a new identity object that is equal to the original object from which the string was obtained. § Its equals method must return true if and only if the two datastore identity objects contain the same identity value, and its hashCode method must return the same integer value for different identity objects when they contain the same identity value. Two of the requirements on the list are especially interesting. First, the datastore identity object is serializable. Hence, it can be stored and passed to other JVMs. Second, the toString method returns a string that can be used to re-create the identity object. In this book, this string value is called the identity string. An identity string is v







