[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2672) Need Support Readonly Session

kindy wu (JIRA) noreply at atlassian.com
Fri Jun 15 02:52:52 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27254 ] 

kindy wu commented on HHH-2672:
-------------------------------

yes,i think readonly session don't need to guarantee uniqueness. 

if we use "left join fetch" to select a one to many object we also will get mutilp object for same id.
IList<Order> orders = session.CreateQuery("From Order  o  Left Join Fetch o.OrderItems ").List<Orders>();
orders = Util.Distinct<Orders>(orders);
public class Util
    {public static IList<T> Distinct<T>(IList<T> list)
        {
            Assert.IsNotNull(list, "Null Collection!");

            if (list.Count == 0)
            {
                return list;
            }

            ISet<T> s = new HashedSet<T>();
            s.AddAll(list);
            list.Clear();
            foreach (T t in s)
            {
                list.Add(t);
            }
            return list;
        }
}

so it just my point of view ,thanks.

> Need Support Readonly Session
> -----------------------------
>
>                 Key: HHH-2672
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2672
>             Project: Hibernate3
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 3.2.4.sp1
>            Reporter: kindy wu
>
> I think we need a readonly session to impove the Select performance!
> code is like this:
> session.SetReadonly(true);//or ReadonlySession rSession = new ReadonlySession(session);
> Code cs = session.CreateQuery("From Code c");//table codes is very huge
> if we set the session to Readonly then the Save,Update,Delete,SaveOrUpdate method is disable.
> and the entities that select from session is not need to write into session cache and don't need to 
> generate proxy for lazy fetch.
> In a Word Readonly Session work like ibatis and Support good Performance for huge Data Collection.

-- 
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