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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:40:51+00:00 2026-06-11T22:40:51+00:00

Say I have made Objectify4 work with my project (although I am still working

  • 0

Say I have made Objectify4 work with my project (although I am still working on making it work) is it possible to persist an Entity with Map field like this:

class Foo {
  Map<String, Object> map; 
  public Foo() {}
  public Foo(Map map) {
   this.map = map;
  }
}

The basic idea is to be able to store/persist a “generic” field that can be either

  • java.lang.String
  • java.lang.Number
  • java.lang.Boolean
  • null
  • java.util.List
  • java.util.Map

For example I can store this:

map.put("uid:sarah:fname", "Sarah");
persist(new Foo(map));

Or

map.put("uid:sarah:age", 25);
persist(new Foo(map));

Is this even possible with Objectify? or App Engine?

  • 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-11T22:40:53+00:00Added an answer on June 11, 2026 at 10:40 pm

    This will work as-is with Objectify4, with a couple caveats:

    1. You can’t use the ‘.’ character in the key name
    2. The Object value will not be translated at all; it will be whatever the datastore accepts.

    1 is because this ends up being stored in the raw Entity as field.keyname (with possibly several layers of ‘.’ separating embedded fields).

    2 is because you’re removing any type information so Objectify just treats Object as-is. It’s like you’re using the low-level api directly; you can only store primitives or collections of primitives. No arrays, certainly no Maps. Collections always come back as List. Numbers always come back as Long no matter what size they are stored as. There are some other quirky behaviors too.

    If you really want this behavior, you can create a custom TranslatorFactory which will introspect the types at runtime and do just about anything you want. This is pretty advanced, however, and will require some study of the existing translators. We can help you out on the Google Group; stackoverflow is probably not the right place for this discussion.

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

Sidebar

Related Questions

Say you have a linked list structure in Java. It's made up of Nodes:
I have made an array that take an input say 12345 and splits it
Lets say you have a FooManager made to manage multiple objects of type Foo
I have a class library project that i have made. Let's call it ClassA.
Say that I have made some software (which has both library form and can
I have made one file say a.php. Now I want some thing like if
I have made following relative layout in an xml file lets say add_relative_layout.xml <?xml
I am an amateur to say the least, but I have made a few
I have made a query to show a Info box or you can say
I've got an HTML text field that I have made READONLY. Thing is though,

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.