CHAPTER 5 Inheritance and custom types You now (Web host)
CHAPTER 5 Inheritance and custom types You now know everything you need to know about the mapping of entities, properties, and inheritance hierarchies. You can already map complex domain models. In the second half of this chapter, we discuss another important feature that you should know by heart as a Hibernate user: the Hibernate mapping type system. 5.2 The Hibernate type system In chapter 4, we first distinguished between entity and value types a central concept of ORM in Java. We must elaborate on that distinction in order for you to fully understand the Hibernate type system of entities, value types, and mapping types. 5.2.1 Recapitulating entity and value types Entities are the coarse-grained classes in your system. You usually define the features of a system in terms of the entities involved. The user places a bid for an item is a typical feature definition; it mentions three entities. Classes of value types often don t even appear in the business requirements they re usually the fine-grained classes representing strings, numbers, and monetary amounts. Occasionally, value types do appear in feature definitions: the user changes billing address is one example, assuming that Address is a value type. More formally, an entity is any class whose instances have their own persistent identity. A value type is a class that doesn t define some kind of persistent identity. In practice, this means that entity types are classes with identifier properties, and value type classes depend on an entity. At runtime, you have a network of entity instances interleaved with value type instances. The entity instances may be in any of the three persistent lifecycle states: transient, detached, or persistent. We don t consider these lifecycle states to apply to the value type instances. (We ll come back to this discussion of object states in chapter 9.) Therefore, entities have their own lifecycle. The save()and delete()methods of the Hibernate Session interface apply to instances of entity classes, never to value type instances. The persistence lifecycle of a value type instance is completely tied to the lifecycle of the owning entity instance. For example, the username becomes persistent when the user is saved; it never becomes persistent independently of the user.
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.