Our suggestion is to get lightweight objects from Hibernate using nested new's in HQL "select new" feature.
Currently, the following HQL statement works fine:
select new Store(store.id, store.description) from Store store
However we can not do a nested instantiation like:
select new Store(store.id, store.description, new Section(store.section.id, store.section.name)) from Store store
We have done some custom changes in our Hibernate 3.0 alpha source code in order to support it.
The changed classes were:
The new class is:
We would like to know if Hibernate Team has some interest to analyse this contribution and maybe add this feature to future versions of Hibernate.
Hibernate 3.0 alpha