Noel Trout commented on Improvement HHH-1123

So, I doubt this is going to matter as the issue has now already been resolved. But since you asked Steve, I have two particular use cases.

1. We map our collections often with @BatchSize as we often we are loading a lot of parent entities and when we access the collection of one we are eventually going to need to access the collection of another. Today we mostly annotate these with @BatchSize(size=2000) to obey the SQL Server prepared statement limits as the collection load is eventually translated to a prepared statement of in (?,?,?...) by class JoinWalker. Now, with 3000 entities in session I am going to be performing multiple selects because of my constrained batch size. The simple reality is that if I could instead perform one select with a bigger IN clause, I would get better performance. This is not ridiculous; this is a fact in our environment and with our data sets. So, as we use numeric database IDs, I would like an API where I can execute my lazy collection load with a SQL string via a statement and not a prepared statement to get around this limit. I understand this is very specific to our case, so I do not expect Hibernate to solve this inherently but an API extension point would be nice.
2. We have some queries that we execute in native SQL as we use features / joins / etc. that Hibernate does not support. This is fine, but these are used for filtering to determine the appropriate data set to use and then we want to get the entities mapped with Hibernate to manipulate. Today, we do this by executing the native query in JDBC to collect ids, and then executing a second query via Hibernate to load the entities with an ID in (X,Y,Z) clause. We are not using native mapped queries as we are often fetching extended object graphs for performance and the native query mechanism is quite cumbersome for this as we are using Hibernate behind the JPA API as a provider. So, in this particular case, I would get a lot better performance if I could skip executing two queries and instead create a common table expression (CTE) / temporary table out of the first select and then use that in a Hibernate where clause. There seems to be a number of people looking for this type of temporary object support.

If I am missing a feature of Hibernate that meets these use cases and I am way off base with this particular bug, I would be happy to be enlightened. Thanks, Noel

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira