I have a complex named query in my entity bean that joins a few tables and uses the group by query function to aggregate the resultset. One of the column in the resultset is also a count() a table column thats grouped. My requirement is to display the resultset in a table format using the rich:dataTable tag. The List object containing the resultset for the dataTable cannot be any of the type of any of my entity beans since each record in the resultset is a complex object and it also has additional count() columns. Is there any way I can implement this without a DTO object? or writing my own DTO object which would model my resultset my only option? I understand that you want to avoid creating DTO object with the Seam framework. Lazy loading may not be an option in this case since I need to aggregate the records using a group by and I also have to do a count(COLUMN_NAME)
Your case normally calls for a DTO (Seam recommends avoiding DTOs when they are simple mirrors of entities, not when they represent aggregates). Inside a DTO you still have the option of using entities instead of merely their fields, as well as any extra fields, like the count.