Hi,

Some time ago I submitted a minor bug having to do with named sql query mapping/binding (http://opensource.atlassian.com/projects/hibernate/browse/HHH-3108) and subsequently fixed it. Hibernate page mentions that contributions should be submitted in patch format, but doesn't say to what version / svn tag - I presume last stable one, that is 3.2.6.ga?

As I already spent some time debugging and got a basic understanding of the code, I thought I might add some functionality I heavily miss. The question is, is it possible for such a user contribution to make it to be incorporated into the code? If so, what would be the procedure and requirements?

My issues with hibernate I'd like to improve concern efficiency and control of fetching whole graphs of objects with many associations:

1. First of all, a possibility of specifying a custom collection loader for fetch='subselect' on a per-query basis. The root query would be able to define a subselect query used to fetch collections owned by returned entities (ideally also nested associations). If original query is complicated (involves joins or subselects), current solution is highly ineffective and I found I could often write optimized queries returning the same data. This is especially pronounced when a large percentage of total data in the table is returned by associated queries.

2. Do some automatic optimization for fetch="subselect". Most notable example is fetching collections defined in subclasses of an entity returned by a polymorphic query. When using table-per-concrete-subclass approach, first query results in an SQL with a couple of joins, and is then used literally as a subselect in the query for associated objects. In most cases it would be sufficient to do the subselect only against the base class table.

3. Allow to use HQL queries as collection loaders, not only SQL queries. I don't know, maybe you're currently working on it - it seems so natural and I've seen a feature request in JIRA.

If you'd be interested in such improvements and find them compatible with the project's roadmap, please let me know. I am very enthusiastic about seeing them in hibernate - the lack of 1) pushed us to drop hibernate for a more flexible, low-level solution in some projects having a complicated object model (arguably exactly those which would really benefit from a model-driven persistance approach). Unfortunately, there's no way my company would allow usage of an in-house patched version of hibernate, so my work on such a patch would be mostly a waste of time if it didn't make it to a release one day.


Best regards,

--
c):-i Marcin MoĊ›cicki
---------------------------------------------------------------------------------------------------
It is, as far as he knows, the only way of coming downstairs,
but sometimes he feels that there really is another way,
if only he could stop bumping for a moment and think of it.
And then he feels that perhaps there isn't.