Is there any truly practical way to avoid using DTOs, when passing data through Hibernate-backed transactional service methods? In other words, are DTOs the only non-hacky solution to avoiding lazy initialization problems?
I think the two popular alternatives to DTOs and the reasons I don't really like them are:
Open Session in View pattern. This I don't like as I would like to keep the service methods truly transactional (i.e. the Hibernate session is committed and closed when the method exits). This is mainly because I would like to not have to worry about transactions if I for example need to publish the service as a web service later on.
Passing domain/business objects through service methods instead of DTOs and eager fetching the needed attributes/properties. This is somewhat better. However in a non-trivial domain object hierarchy with complicated entity relations the eager fetching has to stop somewhere. And when it does, I can't see how this wouldn't very quickly turn into a complete hackaton replacing entities with referencing ids all over the place.
Am I missing something or are DTOs in fact the only solid approach from maintainability's point of view?