Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 728173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:39:03+00:00 2026-05-14T06:39:03+00:00

I am currently working on a simple web application through Google App engine using

  • 0

I am currently working on a simple web application through Google App engine using GWT. It should be noted that this is my first attempt at such a task.

I have run into to following problem/dilema:

I have a simple Class (getters/setters and nothing more. For the sake of clarity I will refer to this Class as DataHolder) and I want to make it persistent. To do so I have used JDO which required me to add some annotations and more specifically add a Key field to be used as the primary key.

The problem is that using the Key class requires me to import com.google.appengine.api.datastore.Key which is ok on the server side, but then I can’t use DataHolder on the client side, because GWT doesn’t allow it (as far as I know).

So I have created a sister Class ClientDataHolder which is almost identical, though it doesn’t have all the JDO annotations nor the Key field.

Now this actually works but It feels like I’m doing something wrong. Using this approach would require maintaining two separate classes for each entity I wish to have.

So my question is: Is there a better way of doing this?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:39:04+00:00Added an answer on May 14, 2026 at 6:39 am

    You are correct in thinking that keeping two versions of your objects feels wrong — the whole idea of GWT is that you can share your server-side objects on the client-side, and if you start divorcing the two you’re not taking full advantage of GWT.

    As to solving your problem, I’ve heard nothing but good things about Objectify, an alternate API into the datastore that’s build just for App Engine. Among its many advantages, it’s also GWT-safe, so you can pass Keys and everything back and forth between client and server. Read more here.

    However, if you want to use JDO/JPA, you can just store your entity IDs as Strings or Longs, like so:

    @PersistenceCapable(identityType = IdentityType.APPLICATION)  
    public class SomeDomainClass implements Serializable {  
      @PrimaryKey  
      @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)  
      @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")  
      String id;
    }
    

    Read more about that here (which is where I shamelessly stole that code example)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a simple web application where users each have their own
I am currently working on a simple Silverlight app that will allow people to
I am working with google app engine and using the low leval java api
I'm currently working on a project for a web application that may be installed
I am currently working on securing a web application using spring-security 3.0. I have
I am currently working on one messy web application. In this application, there is
I'm currently working with a part of my application that uses Dynamic Web User
I have a web application that I am currently working on that uses a
I am currently working on an advanced web application that contains a number of
I'm currently working on a small web application using Visual Studio 2008 Express. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.