-1

I am running the following JDO code on an app engine server.

I am getting the following error message:

org.datanucleus.jdo.exceptions.ClassNotPersistenceCapableException: The class "The class "java.util.ArrayList" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found." is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data for the class is not found.

Here is my class:

@PersistenceCapable(detachable="true")
class Store {

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private Key key;

  @Persistent
  @Element(dependent = "true")
  private List<User> users;

  List<User> getUsers() {
    return users;
  }

}

When I run

pm.makePersistent(store.getUsers());

I get the above exception. Any idea as to why this is happening? I thought the documentation stated I could have a List<> as a persistent element and that it would turn into a multivalued property.

Thanks,

John Goche

johngoche9999
  • 1,471
  • 2
  • 13
  • 21
  • I guess the List class is not itself persistence capable so one must do a pm.makePersistent(store); for it to be persisted. (?) – johngoche9999 Jan 29 '12 at 13:41

1 Answers1

2

I "guess" because that method takes an object and you pass in a List. If you want to persist a List of persistable object I would expect to call pm.makePersistentAll(), which is what the JDO docs all say.

Bart
  • 18,467
  • 7
  • 66
  • 73
user383680
  • 39
  • 3