Chapter 3. Mapping simple data structures
This chapter covers
- Index mapping of an entity class and its identity property
- Index mapping of properties (built-in bridge, indexing strategy)
- Using an analyzer
Chapter 2 gave us a very brief introduction to data mapping. This chapter will explain in greater detail each basic mapping structure, the reasoning behind it, and more important, in which situation it is useful. You will learn how to declare an entity as indexable, which properties are indexed in this entity, and what kind of indexing strategy is used. But before that, let’s see why mapping is required.
The world in which our primary data structure lives (the object-oriented domain model) has a completely different model than the index structure. Let’s talk about a few of the differences highlighted by figure 3.1 and see how those contradictions can be solved.
An object-oriented domain model in Java has a few notable characteristics:
- It is polymorphic. A class can inherit the structure from a superclass.
- It has a strong type system. Each attribute of a class has a type that precisely represents the data. In particular, different data types aren’t interchangeable.
- It has a rich and extensible type system. Types can be any of the many built-in types provided by the JRE or a custom one. Specifically, any program can define its own classes.