I'm unable to create a multimap index with the JDO Score class below. If I substitute Object[] for Score everything works fine. I thought the issue was that the Score class was not serializable? What am I missing from the Score class?
Score Class:
@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
@javax.jdo.annotations.Version(strategy=VersionStrategy.VERSION_NUMBER,column="VERSION",
extensions={@Extension(vendorName="datanucleus", key="field-name",value="version")})
public class Score implements Serializable {
private static final long serialVersionUID = -8805789255398748271L;
@PrimaryKey
@Persistent(primaryKey="true", valueStrategy=IdGeneratorStrategy.IDENTITY)
private Key id;
private Long version;
@Persistent
private String uid;
@Persistent
private Integer value;
}
Multimap index:
List<Score> rows = new ArrayList(scores);
Multimap<Key, Score> grouped = Multimaps.index(rows,
new Function<Score, Key>() {
public Key apply(Score item) {
return (Key) item.getObjKey();
}
});