Hello GWTers,

I'm working on a project using GWT and Hibernate. We love this technology 
and we would like them to coexist :-)

We have a pre-requisite immutable : use Hibernate entities into the GWT 
presentation layer. We tested Gilead but this solution does not suit us. We 
find it overkill compared to our needs. We ‘feel’ there is a lighter 
solution to respond our needs.

For example, we use only attribute ‘lazy=false’ in our hibernate mappings. 
We teach our developers to control relations that are loaded. If a relation 
is not loaded we would like to receive an LazyInitializationException in 
both server and client side. So we don’t need to reattach entities.

Hibernate automatically generates proxies between objects: HibernateProxy in 
the case of a relation ? -> 1 and PersistentCollection in the case of a 
relation ? -> n. We would like to have CRUD with objects loaded via 
Hibernate when relations are loaded or not.

To avoid the expensive clone and merge operations doing by Gilead. We wanted 
to try to fit in the GWT process of serialization / deserialization.

For this we haven’t yet found other ways to copy/paste :-( multiple classes 
to override GWT methods :
* AbstractSerializationStreamReader # readObject () (method final)
* ServerSerializationStreamWriter # writeObject (Object) (class final)

In the case of a relationship?  -> 1 unloaded (so with a proxy), we use a 
MHibernateProxy to transfer an id to be able to retreive the proxy in 
session. We created a MHibernateProxy_CustomFieldSerializer server side and 
client side. 
We have a GWT Generator which generates for each entity a mock version of 
the entity usable if the relation is not loaded. This mock has an extra 
field for the id of the proxy and an implementation of each method of the 
entity which ‘throws a new NotLoadedException()'. 

Here is an example of the code : https://gist.github.com/953375 .

What do you think of this ? Are we mad ?
Is there a better way to fit into the mechanism of serialization / 
deserialization of GWT?
Is it reasonable to ask to the GWT team to remove the final keywords in the 
class AbstractSerializationStreamReader and ServerSerializationStreamWriter?

Thanks for your response,

And a big thanks to the GWT team who does a really great job !

// Thibault

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to