[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6857) Stateless Sessions, Criteria & "possible non-threadsafe access to the session" (but not with createQuery(String)
Paul Smith (JIRA)
noreply at atlassian.com
Mon Nov 28 05:43:23 EST 2011
Stateless Sessions, Criteria & "possible non-threadsafe access to the session" (but not with createQuery(String)
----------------------------------------------------------------------------------------------------------------
Key: HHH-6857
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6857
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.6.8
Reporter: Paul Smith
I originally posted most of the following on HHH-3220 which is salient to this discussion, I'll paste that here verbatim, but suffice to say that with StatelessSession.createCriteria(EntityClass) with Table_per_Class causes the infamous 'non-threadsafe' exception, yet StatelessSession.createQuery(String) does not:
[original post from HHH-3220]
I know this is marked as closed in 3.6.0+ however I'm hitting this exact same problem with 3.6.8.Final with a InheritanceType.TABLE_PER_CLASS setup, only when I issue a:
{noformat}
Criteria criteria = statelessSession.createCriteria(com.aconex.tasks.domain.Task);
...
criteria.scroll(ScrollMode.SCROLL_INSENSITIVE);
{noformat}
Which scrolls through the entire result-set, the above fails with the "non-threadsafe" error. However issuing an effectively-the-same-query using the createQuery method with:
{noformat}
Query query = statelessSession.createQuery("from com.aconex.tasks.domain.Task");
....
query.scroll(ScrollMode.SCROLL_INSENSITIVE);
{noformat}
actually works fine.
We originally had this Query-based execution failing with the non-threadsafe error under hibernate-core 3.3.0.GA, upgraded to 3.6.8.Final to fix the problem (as is documented here), and then have needed to switch to using Criteria for more flexible partitioning of the query (parallelise the row retrievals) now to find us back with the same problem.
Switching to/from Criteria-based scrolling through the entire tablespace fails/succeeds respectively.
Is there anyone out there with advice? I'm a bit confused as to whether the SessionWrapper class will help or not, I don't understand why a Criteria-based "select *" is executing any different than an explicit "select *" (which is what 'from <entity>' with no other criteria is right?)
Any help really appreciated, I have 130 million records I need to scroll through that I don't really want to use a stateful session.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list