Abstract
In this chapter, we’ve introduced the fundamentals for defining a domain model with Hibernate. You learned about the mapping process and how you can use annotations to provide Hibernate with the appropriate clues to effectively map your object-oriented domain classes to your relational database.
We also examined association mapping, differentiating between the various cardinality options Hibernate provides. These details—such as whether to use many-to-many or one-to-many associations—have a significant impact on your domain model design, as well as the resultant database schema. Furthermore, it is important to think carefully about whether an association should be unidirectional or bidirectional. While bidirectional associations are often necessary to simplify reference walking and access, this option can have consequences in terms of circular dependencies that may complicate marshaling implementations.
Hibernate provides a powerful feature called cascading that allows you to associate the operations applied to one entity with its children entities so that these operations cascade. This feature is useful for ensuring that child entities are kept in sync with the state and life cycle of their parent entities.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Editor information
Rights and permissions
Copyright information
© 2010 Paul Tepper Fisher and Brian D. Murphy
About this chapter
Cite this chapter
Fisher, P.T., Murphy, B.D. (2010). Domain Model Fundamentals. In: Anglin, S., et al. Spring Persistence with Hibernate. Apress. https://doi.org/10.1007/978-1-4302-2633-8_5
Download citation
DOI: https://doi.org/10.1007/978-1-4302-2633-8_5
Publisher Name: Apress
Print ISBN: 978-1-4302-2632-1
Online ISBN: 978-1-4302-2633-8
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)