0
votes

I have the following entity

class Student {
  String name;
  Ref<Course> course;

  public Course getCourse() { return course.get() }
} 

I am trying to serialize the Student and put it in my custom Memcache. Serializing an entity with ref causes it to turn into dead ref. When i get the entity back from memcache How do i make sure that it fetches the recent data back from datastore.

TLDR: I am trying to serialize an deserialize objectify entity with Ref<> attribute. After i have deserialized them how to i ensure that the ref loads the value again from datastore? I dont want to clear the session cache for all entities.

1

1 Answers

0
votes

Can you use Key<?> instead? Then just load the keys as necessary instead of Ref.get().

Ref's serialization behavior is to actually serialize an object graph - for example, if you wanted to send a whole graph across the wire. It's not clear that this was the right choice, and maybe it's time to eliminate the DeadRef in v6. Thoughts?