Hi ch4mp,
In service-context.xml, please see the definition of quoteService and myObjectBO beans. I am trying to inject myObjectBO into quoteService bean.
here’s my QuoteServiceImpl class:
I set a breakpoint on the setter of myObjBO and the getQuote method. On initializing the context I’m getting the breakpoint from the setter for myObjBO been invoked and I see that property been injected with correct value. But, when the getQuote method is been invoked, the myObjBO is null. So somewhere in the middle (I cannot find exactly where ) the spring bean myObjBO is been wipe out (??) and not injected anymore. Is there any process in place that keep active the beans that extends the RemoteServiceServlet while the app is running? Any ideas?Code:package com.totsp.sample.client; import java.util.ArrayList; import java.util.List; import java.util.Random; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.totsp.sample.bo.IMyObjectBO; public class QuoteServiceImpl extends RemoteServiceServlet implements QuoteService { private Random randomizer = new Random(); private static List quotes = new ArrayList(); private IMyObjectBO myObjBO = null; static { quotes.add(”No great thing is created suddenly - Epictetus”); quotes.add(”Well done is better than well said - Ben Franklin”); } public void setMyObjBO(IMyObjectBO myObjBO) { this.myObjBO = myObjBO; } public String getQuote(){ return quotes.get(randomizer.nextInt(quotes.size())); } }
Thank you,
Cristian
Hi,
I have the same issue, using my domain classes in my client side GWT implementation.
my package structure is like the following:
com.webmailr.entity [all my domain classes]
com.webmailr.client [GWT client classes]
com.webmailr.client.service [service Interfaces]
com.webmailr.server [service implementations]
in my services I try to use classes from my entity package. I've implemented those with IsSerializable.
However, when using the GWT-compile script, I get the following errors:
Note: I don't get this error when implementing those classes in the com.webmailr.server package.Code:[java] [ERROR] Line 16: No source code is available for type com.webmailr.entity.user.User; did you forget to inherit a required module?
The way I understand it, the compiler can't "find" the source for those files, however it's in the very same Eclipse project and 'src' folder...
I understand this has something to do with the client-side compiling of those classes...
I've been reading about this, and I think I'm missing out on something. I don't want to duplicate models as stated before. So what am I doing wrong ? :-)
Hi Dotbart, this one may be easy (RTFgoogleM). Java sources are required to produce client side javascript.
- have you declared entity package as a GWT module (Entity.gwt.xml in com.webmailr package) ?
- Is Entity GWT module included in your client module (<inherits name="com.webmailr.Entity"/> in YourApp.gwt.xml) ?
- Are sources attached to the entity jar (if any) ?
- Have you declared a java dependency on both entity and entity-sources jars ?
- If using maven, have you re-installed sources ?
Hi Cristian, I had no time to read and reproduce the tutorial you mentioned. Maybe tonight but really not sure.
Oh, thanks a lot! Silly me for diagonally reading the Google manual, and therefore skipping The Module XML part.
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 :-)
For people who are still looking for a solution for this problem, I recommend using the GiLead library. Previously called hibernate4gwt.
It allows you to port those annotated classes to GWT and even includes lazy loading!
Anyone have any insight into how we can make the most of Spring?
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:
https://67.34.106.43/gwtss
Thank You…
Mick Knutson, President
BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (855) BASE-LOGIC: (227-3564-42)
p. (478) BASE-LOGIC (227-3564-42)
f. (415) 685-4233
Website: http://baselogic.com
Blog: http://www.baselogic.com/blog/
Linked IN: http://linkedin.com/in/mickknutson
Twitter: http://twitter.com/mickknutson
---
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.
-Sameer