Hello Sanj Lazy loading works, as far as I understand Hibernate4GWT/Gilead in the simplest way possible: a lazy reference is at the time of RPC serialisation just nulled out (am I correct Bruno?). So you have to make sure that the references and collections you care about have been instantiated before sending out to the world.
I am not clear where the n+1 selection problem meets Hb4GWT/Gilead exactly - but again then, maybe I am too simple minded to comprehend the deeper reasoning behind all of this. In my projects where I use Gilead I have written a few HQL queries which LEFT JOIN FETCH all the entities I care about - that's like 5 minutes work and hardly more than a minor nuisance. On Fri, Apr 10, 2009 at 2:19 PM, SunilBansal <[email protected]>wrote: > > Hello George, > > I checked out Hibernate4Gwt and try to check the samples. Here i found > one example related to User and Message. But when i try to evaluate it > then i found that there is no lazy loading and here i am facing the > same problem i.e. n+1 select problem. > > Would you tell me? How can i use hibernate4Gwt for resolving > performance issue? > > Regards, > > Sanj. > > On Mar 25, 12:08 pm, George Georgovassilis > <[email protected]> wrote: > > HelloSunil > > > > I'm not quite sure why you run into this problem. I am using lazy > > Lists abudantly with GWT mapped to a bag and it works like a charm. As > > a side note, I am not using the dynamic proxy feature but rather > > extending the LazyPojo. > > > > On Mar 25, 6:23 am, Sanj <[email protected]> wrote: > > > > > Hello Friends, > > > > > When i was trying to use hibernate in GWT then i was found one major > > > problem i.e. PersistentBag is not serializable. For resolving this > > > issue, i read many blogs. According to the blogs, i found many > > > solutions but at last i found when i am using this method then there > > > is some performance methods and can't use hibernate lazy-loading > > > properly because we can't use lazy-loading outside the scope of the > > > Session and so when we use the Hibernate in GWT then we need to close > > > the session on the service/server level while we send the object on > > > the client side. Some described solution for using hibernate in the > > > group are :- > > > > > 1.)Array instead of collection :- > > > One is the major solution for using the > collection object, use > > > array instead of the Collection object. But with this solution there > > > is lot of overhead on the user part i.e. maintain the array properly > > > with index values. > > > 2.)Inverse-Owner objects :- > > > One another solution for supporting the > colletion in the hibernate > > > i.e. use only inverse-owner objects instead of the collection object > > > but in this case there is one major problem i.e. whenever we need to > > > use the collections data then we need to send the one extra call on > > > the server everytime for collecting the collections objects and for > > > maintaining that thing code readability also lost. > > > 3.)Maintain PersistentBag/PersistentSet Serializable class :- > > > Somewhere i read about create one serializable > class for > > > PersistentBag,PersistentSet and use it. But in this case, we need to > > > create that class on the client side package and while we are creating > > > this after that problem starts i.e. GWT not support for importing > > > org.hibernate.PersistentBag on the client side. > > > 4.)Convertor class :- > > > One another method for using hibernate in GWT > is Convertor class > > > i.e. when you send your Object on the client side then you need to use > > > the Convertor class for changing all the PersistentBag/PersistentSet > > > objects in Collection objects.In this case, performance is decreased > > > badly because of lazy-loading .But it's working fine. > > > > > I used the fourth method with some changes for > increaing the > > > performance. I include one Obect Fetch Plan design pattern with the > > > lazy loading. In this pattern, we need to create one xml file where we > > > define the fetch plans with the binding name. for e.g. suppose i have > > > one object A and A having collection of B,C,D and E, F 1-1 objects in > > > class A.B having 1-1 objects of B1, B2. Suppose in this case when i > > > need to fetch the A object from the database then fetch only A, B, B1 > > > not all the other objects as defined in the A objects and in another > > > fetch plan, fetch only A,C,E,F objects then we need to create two > > > fetch plans which we bind with the corresponding Fetch-Plan-Name i.e. > > > A_B and A_C_E_F. > > > > > When we use hibernate in this way, then i know > there is also lazy- > > > loading problem but we can control on the fetching of the objects > > > while we convert the Collections objects. In this way, we need to care > > > one thing i.e. use lazy="true" for collection and 1-1 objects. > > > > > Thanks and regards, > > >SunilBansal, > > > +91-9784175320 > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
