Domain Model Lazy Loading
Entities in a domain model are often related to each other.
Domain model lazy loading. Onetoone onetomany manytoone manytomany. Lazy loading eliminates the need for additional hops between the domain model and controllers. Sample code for this article. Madhura oak oct 31 2013 java technology.
It was a monday. While that conversation was centered around bypassing repositories for access data which is not true since your aggregate roots are. Hopefully this article has made lazy loading seem less magical to you. Java s capabilities to create proxies to lazily load a rich domain model are surprisingly strong and easy to use.
Again i also wish the vendors within this space started will start lazy loading more. Jpa 2 0 provides the following 4 annotations to define the relationships between entities. Does lazy loading via properties violate domain driven design principles. When you lazy load you can load data that is not consistent.
Jpa 2 0 provides the following four annotations to define the relationships between entities. Onetoone onetomany manytoone manytomany the default fetch type of onetoone and manytoone is eager fetch which means that while loading an entity the related entities would also get loaded whereas the. If you lazy load an order first the header then the lines and someone adds a line in the meantime your. Entities in a domain model are often related to each other.
Some comments to a recent post on jeremy miller s blog raised the question of whether nhibernate s lazy loading capabilities violate domain driven design.