Java Magazine, May/June 2018
ORACLE COM JAVAMAGAZINE MAY JUNE 2018 55 design patterns return entityManager merge instrument The boundary services typically delegate complex domain logic to other services These delegates such as InstrumentMaker are injected into the beans via dependency injection Aggregates Aggregates represent more complex domain entities that consist of multiple entities or value objects They are accessed and managed as a whole by a single root object to ensure integrity and consistency In JPA persistence operations are invoked on the root entity of an aggregate The operations cascade to the other entities of the aggregate In the following example I examine a GuitarBody type which will become part of an aggregated electric guitar The ElectricGuitar type represents the root entity of the aggregate The GuitarBody type is another entity in the instrument domain @ Entity public class GuitarBody @ Id private long id @ Enumerated EnumType STRING @ Basic optional false private Material material @ Enumerated EnumType STRING @ Basic optional false private Color color
You must have JavaScript enabled to view digital editions.