Reputation: 233
I am using Apache CXF with Spring and Dozer Mapper to convert DTOs (Database Objects) in to models. For Hibernate side I have enabled lazy="extra"
and lazy="true"
for mapping and which works fine hibernate loads child whenever respective getter methods are called. But when I convert DTO using dozer mapper it calls getter methods of all the child object in some case it was not necessary but in some it is not necessary. Is there any way by using which I can reduce overheads.
Upvotes: 0
Views: 1679
Reputation: 6759
Fetch(load) child's always in every call results to heavy process and unnecessary data to persist. So instead of doing this always fetch data as lazy and initialize child's model whenever there is need. This is the best way to fetch data.
Upvotes: 2
Reputation: 596996
If you convert entities to DTOs, you have two options:
Upvotes: 2