Hello, that's the reason. To use a java library in GWT this must be translatable to javascript, i.e. source code must be available, packaged in a gwt module, and only compatible classes must be used.
As Jeff mentioned there's a number of libraries which try to make persistence related classes compatible to GWT. I can mention this article on the subject http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html, but I can't give more help since I never tried such libraries myself. Also, you might want to join the GWT discussion group here http://groups.google.com/group/Google-Web-Toolkit to ask gwt related questions. Regards Lorenzo On Feb 21, 7:14 am, Kayode Odeyemi <[email protected]> wrote: > Thanks L > > Could this be a reason why my Persistence-aware Entities cannot be > compiled even after placing them under client package? I did relocate > the Entities as well as added to my module file this: > <!-- Specify the paths for translatable code --> > <source path='client'/> > <source path='shared'/> > > But in as much as compile was successful, I still get the errors: > > The import javax.persistence cannot be resolved > [ERROR] Line 10: The import javax.persistence cannot be resolved > [ERROR] Line 18: Entity cannot be resolved to a type > [ERROR] Line 21: Id cannot be resolved to a type > [ERROR] Line 22: GeneratedValue cannot be resolved to a type > [ERROR] Line 22: The attribute strategy is undefined for the > annotation type GeneratedValue > [ERROR] Line 22: GenerationType cannot be resolved > [ERROR] Line 25: Table cannot be resolved to a type > [ERROR] Line 25: The attribute name is undefined for the > annotation type Table > [ERROR] Line 26: NamedQueries cannot be resolved to a type > > On 2/21/11, l.denardo <[email protected]> wrote: > > > > > GWT compiles your java source into javascript using a restricted > > subset of allowed classes, and you cannot use anything built on non- > > compatible classes, tipically you cannot read classes with persistence- > > related annotatios. > > > Source code for your DTO must be accessible to thw GWT compiler. This > > is done adding a "source" entry in your gwt.xml file, as documented > > here: > >http://code.google.com/webtoolkit/doc/latest/tutorial/create.html#com... > > > In your case adding a <source path="com/foo"> should do. > > > regards > > Lorenzo > > > On Feb 20, 7:17 pm, Kayode Odeyemi <[email protected]> wrote: > >> I have resulted into using DTO to provide the client information about my > >> Entity. My DTO has the same getter and setter signatures just like it's > >> respective Entity. > > >> But still getting "No source code is available for type com.foo.UsersDTO; > >> did you forget to inherit a required module?" > > >> How do I then access persisted Entity objects from the client-side? > > >> On Sun, Feb 20, 2011 at 4:46 PM, Kayode Odeyemi <[email protected]> wrote: > >> > To provide more details, I am sending data to the server via GWT-RPC. On > >> > the server I'm returning an Entity class object mapped by JPA. So on the > >> > client, I requested for the object via the normal way (AsyncCallback). > >> > So > >> > when I compile the code, GWT reports a "No source code" error, meaning > >> > I'm > >> > referencing the server class on the client side. > > >> > Some of my findings report that I either create the Entity on the client > >> > side so that GWT can find it or create an implementation of the Entity > >> > on > >> > the client side overriding all the necessary methods. I am not sure > >> > about > >> > the former as I believe the Entity is meant to be on the server because > >> > it > >> > needs access to JPA. On the later, I have no idea of how to implement > >> > that > >> > as the Entity needs access to JPA (GWT can't compile server code on the > >> > client side!). > > >> > Any clues please. > > >> > On Sun, Feb 20, 2011 at 4:10 PM, Kayode Odeyemi <[email protected]> > >> > wrote: > > >> >> Hello, > > >> >> I will appreciate some guide as to where exactly to put JPA mapped > >> >> Entity > >> >> classes. At the moment I have it > >> >> under "com.foo.server.domain". But whenever I compile the app, GWT > >> >> returns: > > >> >> No source code is available for type com.foo.server.domain.Users; did > >> >> you > >> >> forget to inherit a required > >> >> module? > > >> >> -- > > >> > -- > > >> -- > >> Odeyemi 'Kayode O. > > >> B.Sc(Hons) Econs, Application Developer & Systems Engineer (Sun Certified > >> Professional), > >> Oracle Certified Associate, Solaris Systems Administrator, Drupal > >> Developer > > >> Website:http://sinati.com<http://www.sinati.com> > >> Socialize with > >> me:http://profile.to/charyorde,http://twitter.com/charyorde, > > >>http://www.google.com/profiles/dreyemi > >> Skype:drecute > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google App Engine" 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-appengine?hl=en. > > -- > Odeyemi 'Kayode O. > > B.Sc(Hons) Econs, Application Developer & Systems Engineer (Sun Certified > Professional), > Oracle Certified Associate, Solaris Systems Administrator, Drupal Developer > > Website:http://sinati.com<http://www.sinati.com> > Socialize with me:http://profile.to/charyorde,http://twitter.com/charyorde, > > http://www.google.com/profiles/dreyemi > Skype:drecute -- You received this message because you are subscribed to the Google Groups "Google App Engine" 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-appengine?hl=en.
