[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2625) allow DetachedCriteria to work with StatelessSession

Erwin Bolwidt (JIRA) noreply at atlassian.com
Sun Sep 7 12:09:04 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31098#action_31098 ] 

Erwin Bolwidt commented on HHH-2625:
------------------------------------

Thanks for the patch. That's a really simple and small change.
I actually have a good use for StatelessSessions and I think, if Hibernate supports these StatelessSessions, it should go the whole way and make them first-class citizens.

As a workaround, you can use reflection to set the impl field.

public static Criteria getExecutableCriteria(DetachedCriteria criteria, StatelessSession session) {
        Field implField;
        try {
            implField = DetachedCriteria.class.getDeclaredField("impl");
        } catch (NoSuchFieldException e) {
            throw new Error(e);
        }
        implField.setAccessible(true);
        CriteriaImpl criteriaImpl;
        try {
            criteriaImpl = (CriteriaImpl) implField.get(criteria);
        } catch (IllegalAccessException e) {
            throw new Error(e);
        }
        criteriaImpl.setSession((SessionImplementor) session);
        return criteriaImpl;
    }


> allow DetachedCriteria to work with StatelessSession
> ----------------------------------------------------
>
>                 Key: HHH-2625
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2625
>             Project: Hibernate3
>          Issue Type: Improvement
>          Components: query-criteria
>    Affects Versions: 3.2.4.sp1
>            Reporter: Mario Ivankovits
>         Attachments: DetachedCriteriaWithStatelessSession.diff
>
>
> The attached patch add a new method to DetachedCriteria to make it work with StatelessSession.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list