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,
Sunil Bansal,
+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
-~----------~----~----~----~------~----~------~--~---