We've built up a filter library on top of OpenJPA CriteronQuery is fairly
dynamic allowing population of a number of parameters and currently returns
the associated Entity objects correctly.
For a large majority of the web service calls however, the entity
association as well as the additional overhead retrievals are un-necessary
as we're directly populating the data into a DTO and returning it. The
DTOs do not always map to the Entity objects being returned.
I've been able to modify the library to correctly populate a shallow (No
List<OtherClass> etc) pojo DTO by making use of an array of Selection<>
objects.
I'd like to support the ability to populate fields of child memebers. Eg,
given:
ParentDTO {
List<ChildDTO> childDTO; // associated set/getChildDTO, addChildDTO
}
ChildDTO {
Integer id; String firstName; String lastName; String city
}
I'm not sure how to define the individual elements of the ChildDTO?
Should the child be mapped in the parent as a CompundSelection<>{
Selection<Integer> idPath, Selection<String> firstName } in the parent
selection list? Would this return me v List<Object[]> result set an array
of the corresponding child fields?
The construct() method looks interesting but I've been unable to see how I
can bend it to my will. Is it tied to an entity object or can I map it to
individual POJO's and only for certain elements while handling child
objects selectively also?
Thanks,
--
-------------------------------------------
Craig Taylor
[email protected]