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

  • Home
  • SEARCH
  • 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 7935909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:03:43+00:00 2026-06-03T22:03:43+00:00

I have a Java model similar to: public class Country { @Id private String

  • 0

I have a Java model similar to:

public class Country {
    @Id private String id;
    private CurrencyId currencyId;
    private List<Province> provinceList;
    ...
}

public class Province {
    @Id private String id;
    private Gobernor gobernorId;
    private List<City> cityList;
    ...
}

public class City {
    @Id private String id;
    private String name;
    ...
}

I want to store that data using objectify. However, as Country data might change, I also want to store the date the Country data has been stored, so I think I should store an entity such as:

public class CountryListEntity {
    @Id private String id;
    private List<Country> countryList;
    private Date storeDate;
}

Note I will only have one entity of kind CountryListEntity with the Id “root”, if I can store it like that. I know very little about both how google apps stores data and how objectify works. I’ve tried many combinations of @Embedded, but I got many errors, i.e.

Cannot place array or collection properties inside @Embedded arrays or collections

Can anyone tell me how to define these classes? A snippet of the code needed to store and retrieve this “root” entity, would be highly appreciated!

  • 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-03T22:03:45+00:00Added an answer on June 3, 2026 at 10:03 pm

    @Embedded collections are transformed into a series of collection fields in the
    low-level Entity. That’s why one level embedding is all you can do.

    If you are going to store/load all data at once and if your entities are as simple as the ones in your example you can put @Serialized annotation for your lists inside @Embedded lists.

    You can find out more from this discussion.

    The problem with this approach is that your low-level embeddings won’t be able to be indexed.

    public class CountryListEntity {
        @Id private String id;
    
        @Embedded 
        private List<Country> countryList;
    
        private Date storeDate;
    }
    
    public class Country implements Serializable {
        private String id;
        private CurrencyId currencyId;
    
        @Serialized
        private List<Province> provinceList;
        // ...
    }
    
    public class Province implements Serializable {
        private String id;
        private Gobernor gobernorId;
    
        @Serialized
        private List<City> cityList;
        // ...
    }
    
    public class City implements Serializable {
        private String id;
        private String name;
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have strange problem. I have class which behaves similar dropdown list. package test.view;
I have a list of Objects (the model) that are constantly appended to (similar
I have an enum type on my Java model which I'd like to map
I have a Java project that I'm trying to implement with a model-view-controller design.
I'm following this MVC model: http://java.sun.com/developer/technicalArticles/javase/mvc/ In my model I have an ArrayList shapes
I have a list: private readonly IList<IList<GameObjectController>> removeTargets; private readonly IList<IList<GameObjectController>> addTargets; PickUp inherits
I have a problem when setting a variable inside a Java class Here is
Java and C# are pretty much identical, both have garbage collectors, similar memory models
I have a Java 3D program which uses lots (hundreds) of 3D models (3ds
I have a Java application which is running as non root mode. My App

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.