4.5. Summary

In this chapter, you learned the essential distinction between entities and value types and how these concepts influence the implementation of your domain model as persistent Java classes.

Entities are the coarser-grained classes of your system. Their instances have an independent lifecycle and their own identity, and they can be referenced by many other instances. Value types, on the other hand, are dependent on a particular entity class. An instance of a value type has a lifecycle bound by its owning entity instance, and it can be referenced by only one entity—it has no individual identity.

We looked at Java identity, object equality, and database identity, and at what makes good primary keys. You learned which generators for ...

Get Java Persistence with Hibernate 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.