Yeah, I ran into this issue a year ago when I was working with GAE + GWT-RPC. The client side object cannot have references to any code not associated with a GWT module, so there are a few options for you here.
1) create a translator and maintain 2 versions of the class; 1 for the client(without annotations) and 1 for the server(with annotations) 2) use Java serialization to make a deep copy with 2 versions of the class like specified above (serializeable uuids must be equal). 3) write a utility that uses reflection to translate between the objects above 4) use some sort of 3rd party library that allows for persistence and serialization. There are more options that I haven't listed here, but these are a few to start. On Aug 17, 12:55 pm, Jeff Schnitzer <[email protected]> wrote: > This is a major PITA with GAE+JPA. You'll likely also need to detach > your entities from the JPA session, which AFAIK is impossible with the > JPA interface - only with the JDO interface. > > My advice is throw out JPA and use Objectify. You can use your > entities in GWT as-is (assuming they are client-safe), even if they > reference Key or GeoPt or other datastore classes. Objectify provides > GWT emulation for all those classes: > > http://code.google.com/p/objectify-appengine/wiki/ObjectifyWithGWT > > (I'm the lead developer of Objectify, and I use it with GWT in my > applications every day) > > http://code.google.com/p/objectify-appengine/ > > Jeff > > On Sat, Aug 14, 2010 at 2:26 AM, cokol <[email protected]> wrote: > > again - you shall not have any references inside your translatable > > classes to classes from 3rd party! translatable classes are those to > > be compiled to javascript and which reside in client and shared > > packages. 3rd party classes are those where you dont have sourcecode > > from. > > > consider your Employee just to be a bean or container without any > > logic just with a purpose to carry payload data. so design the class > > NOT to use any classes from appengine like Key, BlobKey etc > > > On 14 Aug., 07:05, "Sree ..." <[email protected]> wrote: > >> Modified the Employee.java as below > > >> *public class Employee implements IsSerializable{* > > >> then moved the Employee.java to shared package. [eclipse updated all > >> references well] > >> Now when I GWT to compile its saying > > >> Compiling module project.xxx > >> Validating newly compiled units > >> [ERROR] Errors in 'file:/C:/xxx/src/xxx/shared/Employee.java' > >> [ERROR] Line 10: The import com.google.appengine cannot be > >> resolved > >> [ERROR] Line 11: The import com.google.appengine cannot be > >> resolved > >> [ERROR] Line 19: Key cannot be resolved to a type > >> [ERROR] Line 101: BlobKey cannot be resolved to a type > >> [ERROR] Line 141: Key cannot be resolved to a type > >> [ERROR] Line 189: Key cannot be resolved to a type > >> [ERROR] Line 190: Key cannot be resolved to a type > >> [ERROR] Line 305: Key cannot be resolved to a type > >> [ERROR] Line 306: Key cannot be resolved to a type > >> [ERROR] Line 424: BlobKey cannot be resolved to a type > >> [ERROR] Line 425: BlobKey cannot be resolved to a type > >> [ERROR] Line 431: BlobKey cannot be resolved to a type > >> [ERROR] Line 432: BlobKey cannot be resolved to a type > >> Finding entry point classes > >> [ERROR] Unable to find type 'xxx.client.Example' > >> [ERROR] Hint: Previous compiler errors may have made this type > >> unavailable > >> [ERROR] Hint: Check the inheritance chain from your module; it may > >> not be inheriting a required module or a module may not be adding its > >> source > >> path entries properly > >> Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook > > >> Why appengine import statements are not working! Again they should be only > >> in server folder? > > >> On Sat, Aug 14, 2010 at 6:17 AM, Sree ... <[email protected]> wrote: > >> > okey... thanks alot guys.... > >> > i ll try to make those changes and will update here > > >> > also thx for so quick responses.. am loving it > > >> > On Sat, Aug 14, 2010 at 2:31 AM, cokol <[email protected]> wrote: > > >> >> hi the problem is that gwt does not have source of your Employee > >> >> class, since you have put it into the server package, you always have > >> >> 3 packages to handle (as per default): > > >> >> client > >> >> server > >> >> shared > > >> >> everything under "client" becomes javascript after compilation and is > >> >> not aware of anything contained in "server" package, everything > >> >> contained in server package is intended to run in java VM and remains > >> >> java, here you may have references to classes used in client package > >> >> if you like, this would not break up gwt. the shared package contains > >> >> everything what is required for client and server package, like the > >> >> service interfaces AND transfer objects & payload classes like your > >> >> Employee. furthermore everything whats inside client and shared > >> >> package has to be translatable to javascript, i.e. you shall not use > >> >> 3rd party libraries in there. > > >> >> so just move the Employee and all related (payload) classes to the > >> >> shared (or client) package and you are done > > >> >> On 13 Aug., 19:39, "Sree ..." <[email protected]> wrote: > >> >> > Am not sure this belongs to GWT or GAE or both ... > > >> >> > So here's my problem... > > >> >> > I have one client/Example.java [contains all GWT code] calls a methods > >> >> on > >> >> > server/SomeServiceImpl.java [Contains code to talk to dataStore] > > >> >> > Wat server/SomeServiceImpl.java does is Featch data from Employee.Java > >> >> > .... [this is class used to store data in datastore JPA] > > >> >> > So now my problem is.. as long as I send data in the form of String or > >> >> > StringArray to client/Example.java am fine, but now I tried to send > >> >> > List<Employee> to client/Example.java > > >> >> > Doing so throws me an error as below.. > > >> >> > Validating newly compiled units > >> >> > [ERROR] Errors in > >> >> > 'file:/C:/XXX/XXX/src/xxx/client/GreetingServiceAsync.java' > >> >> > [ERROR] Line 18: No source code is available for type > >> >> > xxx.server.Employee; did you forget to inherit a required module? > >> >> > [ERROR] Errors in 'file:/C:/XXX/XXX/src/client/Example.java' > >> >> > [ERROR] Line 325: No source code is available for type > >> >> > xxx.server.Employee; did you forget to inherit a required module? > >> >> > [ERROR] Errors in > >> >> 'file:/C:/XXX/XXX/src/client/GreetingService.java' > >> >> > [ERROR] Line 19: No source code is available for type > >> >> > xxx.server.Employee; did you forget to inherit a required module? > >> >> > Finding entry point classes > >> >> > [ERROR] Unable to find type 'xxx.client.Example' > >> >> > [ERROR] Hint: Previous compiler errors may have made this > >> >> > type > >> >> > unavailable > >> >> > [ERROR] Hint: Check the inheritance chain from your module; > >> >> > it > >> >> may > >> >> > not be inheriting a required module or a module may not be adding its > >> >> source > >> >> > path entries properly > > >> >> > -- > >> >> > -Thanks > >> >> > -Srikanth.G > >> >> > -Hyderabad > > >> >> -- > >> >> 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]<google-web-toolkit%2Bunsubs > >> >> [email protected]> > >> >> . > >> >> For more options, visit this group at > >> >>http://groups.google.com/group/google-web-toolkit?hl=en. > > >> > -- > >> > -Thanks > >> > -Srikanth.G > >> > -Google India Ltd > >> > -Hyderabad > > >> -- > >> -Thanks > >> -Srikanth.G > >> -Google India Ltd > >> -Hyderabad > > > -- > > 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 > > athttp://groups.google.com/group/google-web-toolkit?hl=en. -- 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.
