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 8410545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:12:21+00:00 2026-06-10T00:12:21+00:00

Using Objectify 4, name and price fields are not persisted when I save a

  • 0

Using Objectify 4, name and price fields are not persisted when I save a MenuItem object.
Only Key, WriteOps and ID/Name are persisted in the debugging datastore.

@Entity
public class MenuItem extends BaseEntity {
private String name;
private double price;

public MenuItem() {
}

public MenuItem(String name, double price) {
    this.name = name;
    this.price = price;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public double getPrice() {
    return price;
}

public void setPrice(double price) {
    this.price = price;
}
}

Where BaseEntity is:

public abstract class BaseEntity implements Dto {
private static final long serialVersionUID = 8400346403708831769L;

@Id
protected Long id;

protected BaseEntity() {
}

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((id == null) ? 0 : id.hashCode());
    return result;
}

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }

    if (obj == null) {
        return false;
    }

    if (getClass() != obj.getClass()) {
        return false;
    }

    BaseEntity other = (BaseEntity) obj;

    if (id == null) {
        if (other.id != null) {
            return false;
        }
    } else if (!id.equals(other.id)) {
        return false;
    }

    return true;
}

public Long getId() {
    return id;
}

public void setId(@Nullable Long id) {
    this.id = id;
}

public boolean isSaved() {
    return (id != null);
}
}

and Dto is:

public interface Dto extends Serializable {
}

Any ideas? Thanks!

  • 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-06-10T00:12:22+00:00Added an answer on June 10, 2026 at 12:12 am

    As stated on the Objectify mailing list, it may just be your viewing of the datastore that is missing this information.

    Can you show some test code to save this data then retrieve it and print out the results rather than using the datastore viewer? I’d expect:

    MenuItem toSave = new MenuItem("test", 6.3);
    toSave.setId(1);
    ofy().save().entity(toSave).now();
    ofy().clear(); //Make sure we're not just looking at the current session.
    MenuItem loaded = ofy().load().type(MenuItem.class).id(1).get();
    assertEquals(loaded.getName(), "test");
    assertEquals(loaded.getPrice(), 6.3);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was using Objectify 3 and spring before. Now i am trying to shift
I am using objectify on appengine with the java runtime. I am also using
I am using objectify 3.1 on appengine and attempting to do a ancestor query.
I'm using Google App Engine and Objectify 3.1 and slowly learning about denormalization and
I am not sure if I use the @Id in objectify the right way.
I use Objectify for datastore operations in my GAE/Java application. I have used Objectify's
I'm using the Activator to instantiate a new class based on the short name
I am using App Engine (Java) with Objectify and RequestFactory. My entity stores some
I'm using Objectify to store items in a database, and want to enforce uniqueness
I'm currently using a Gwt CellTable, bound to my GAE/Objectify backend via RPC calls.

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.