Chapter 7. Advanced entity association mappings

When we use the word associations, we always refer to relationships between entities. In the previous chapter, we demonstrated a unidirectional many-to-one association, made it bidirectional, and finally turned it into a parent/children relationship (one-to-many and many-to-one with cascading options).

One reason we discuss more advanced entity mappings in a separate chapter is that quite a few of them are considered rare, or at least optional.

It's absolutely possible to only use component mappings and many-to-one (occasionally one-to-one) entity associations. You can write a sophisticated application without ever mapping a collection! Of course, efficient and easy access to persistent data, by iterating a collection for example, is one of the reasons why you use full object/relational mapping and not a simple JDBC query service. However, some exotic mapping features should be used with care and even avoided most of the time.

We'll point out recommended and optional mapping techniques in this chapter, as we show you how to map entity associations with all kinds of multiplicity, with and without collections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset