Skip to content

Instantly share code, notes, and snippets.

@husayt
Created August 15, 2014 18:43
Show Gist options
  • Save husayt/8d4311dae659b61df383 to your computer and use it in GitHub Desktop.
Save husayt/8d4311dae659b61df383 to your computer and use it in GitHub Desktop.
Some Objectify question
@Entity
public class Person {
@Id
private Long id;
@Index
boolean archived;
PersonInfo personInfo;
}
public class PersonInfo {
@Container
Person person;
@Index(IfNotArchivedEmbed.class)
String name;
@Index(IfNotArchivedEmbed.class)
String surname;
protected static class IfNotArchivedEmbed extends PojoIf<PersonInfo> {
@Override
public boolean matchesPojo(PersonInfo pojo) {
return !pojo.person.isArchived();
}
}
}
@husayt
Copy link
Author

husayt commented Aug 15, 2014

Problem: in matchesPojo method in IfNotArchivedEmbed class I get a NullPointer Exception when trying to obtain person instance. It seems @container field is not populated when accessed matchesPojo method on index,

From other places

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment