This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Comment

One way of using GWT with Spring is building a menu-driven web application. My web site, http://minetats.com , has an example of such an application. It is work in progress, soon it will describe how I use GWT and Spring Security together - in the meantime, the Proof Of Concept URL is:

However, now I'm on track with the problem Christoph and behrooznobakht were facing.

I use Hibernate Annotations for my mapping. When importing my entity's using the Module XML file, GWT can't file the javax.persistence.* paths.

How can I handle that part? Putting all of my mapping in a hbm.xml file seems like the only 'pluggable' option (to make my domain model entirely independant from anything else). But it takes away the fun and speed of Hibernate Annotation development :-)

Can you post your solution as I have the same issue, but it is not clear to me what you did to fix the first issue..

Comment

The approach @behrooznobakht suggests seems in line with the anti-corruption layer pattern. If you view the decoupling of the front end layer (in GWT) from the domain layer as important, then it seems logical to have the view model different from the domain entities allowing both sides to grow independently if possible.

Moreover, in the case of GWT the model eventually resides on the client and not on the same server. The practice of using the domain entities across all layers works well when all layers are on the server (like the typical web applications).

A couple of problems faced while moving the domain entities to the client are:
1. Hibernate lazy collection references are not serializable automatically by GWT. A work around will be required for this.
2. What if there is no need to move the entire domain entity object graph to the browser. It could easily result in too much network traffic over the wire. Also, at times there could be a data security/obscurity need to not send some attributes of the domain entity to the browser.

Keeping the model objects focused on the GWT-server interaction and separate from domain service models seems like a good solution for applications that require the benefits.

This discussion thread is a little old. The scenario discussed still has a lot of relevance.