views:

399

answers:

1

The Google AppEngine docs say that I can persist serializable objects using JDO like so

import javax.jdo.annotations.Persistent;
import DownloadableFile;

// ...
@Persistent(serialized = "true")
private DownloadableFile file;

but if I use it with Properties

@Persistent(serialized="true")
private Properties initProps;

I get

DataNucleus Enhancer (version 1.1.0) : Enhancement of classes

Field "initProps" in class "ServletRegistration" has been defined as a Map but the key type is not specified!

Can I fix that with additional annotations?

+2  A: 

Add @Key(types=String.class) @Value(types=String.class)

since "Properties" is a bit of a hack in that it can also contain non-String, and doesn't allow generic specification so you need to restrict it. The next version of AppEngine will have a version of DataNucleus that doesn't require this additional info.

DataNucleus