[appengine-java] Re: Generic type in GAE JDO. Howto?

2010-02-11 Thread Alex Lui
java.util.HashMap is not supported, isn't it? I'm using Google plugin
for Eclipse.
This kind of exception came when I testing the entity having the Map
field in Eclipse.

Caused by: java.lang.IllegalArgumentException: notes:
java.util.HashMap is not a supported property type


The class declaration is:
@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable="true")
public class Person {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Index(unique = "true")
@Persistent(nullValue = NullValue.NONE)
private String name;
@Persistent(nullValue = NullValue.NONE)
private Date birthday;
@Persistent(nullValue = NullValue.NONE)
private char gender;
@Persistent(defaultFetchGroup="true")
@Element(dependent = "true")
private Map notes;
@Persistent
private Text remark;
@Persistent
private boolean isPublic = false;
...
}

On 2月12日, 上午4時10分, "Ikai L (Google)"  wrote:
> I'm a bit curious as you why you are trying to persist a collection class.
> Why not create an entity and persist the Map as a field on the entity?
>
>
>
>
>
> On Sun, Feb 7, 2010 at 10:57 PM, Alex Lui  wrote:
> > As java.util.Map isn't supported by GAE, I'm trying to create a class
>
> > @PersistenceCapable(identityType = IdentityType.APPLICATION,
> > detachable="true")
> > public class DAOMap implements
> > Map {
> > ...
>
> > however, got such exception in Eclipse console
>
> > DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
> > Errors were encountered when loading the specified MetaData files and
> > classes. See the nested exceptions for details
> > DataNucleus Enhancer completed with an error. Please review the
> > enhancer log for full details. Some classes may have been enhanced but
> > some caused errors
> > Feb 8, 2010 2:55:53 PM org.datanucleus.enhancer.DataNucleusEnhancer
> > main
> > SEVERE: DataNucleus Enhancer completed with an error. Please review
> > the enhancer log for full details. Some classes may have been enhanced
> > but some caused errors
> > Errors were encountered when loading the specified MetaData files and
> > classes. See the nested exceptions for details
> > org.datanucleus.exceptions.NucleusUserException: Errors were
> > encountered when loading the specified MetaData files and classes. See
> > the nested exceptions for details
> >        at
> > org.datanucleus.metadata.MetaDataManager.loadClasses(MetaDataManager.java:
> > 426)
> >        at
>
> > org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNu 
> > cleusEnhancer.java:
> > 743)
> >        at
>
> > org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.ja 
> > va:
> > 545)
> >        at
> > org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:
> > 1252)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> >        at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp 
> > l.java:
> > 25)
> >        at java.lang.reflect.Method.invoke(Method.java:597)
> >        at
> > com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:
> > 57)
> >        at com.google.appengine.tools.enhancer.Enhance.(Enhance.java:
> > 60)
> >        at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:41)
> > Caused by: java.lang.IllegalStateException: Unknown type: K
> >        at
>
> > org.datanucleus.jdo.metadata.JDOAnnotationReader.processMemberAnnotations(J 
> > DOAnnotationReader.java:
> > 1748)
> >        at
>
> > org.datanucleus.metadata.annotations.AbstractAnnotationReader.getMetaDataFo 
> > rClass(AbstractAnnotationReader.java:
> > 169)
> >        at
>
> > org.datanucleus.metadata.annotations.AnnotationManagerImpl.getMetaDataForCl 
> > ass(AnnotationManagerImpl.java:
> > 136)
> >        at
>
> > org.datanucleus.metadata.MetaDataManager.loadAnnotationsForClass(MetaDataMa 
> > nager.java:
> > 2278)
> >        at
> > org.datanucleus.metadata.MetaDataManager.loadClasses(MetaDataManager.java:
> > 385)
> >        ... 10 more
> > Nested Throwables StackTrace:
> > java.lang.IllegalStateException: Unknown type: K
> >        at
>
> > org.datanucleus.jdo.metadata.JDOAnnotationReader.processMemberAnnotations(J 
> > DOAnnotationReader.java:
> > 1748)
> >        at
>
> > org.datanucleus.metadata.annotations.AbstractAnnotationReader.getMetaDataFo 
> > rClass(AbstractAnnotationReader.java:
> > 169)
> >        at
>
> > org.datanucleus.metadata.annotations.AnnotationManagerImpl.getMetaDataForCl 
> > ass(AnnotationManagerImpl.java:
> > 136)
> >        at
>
> > org.datanucleus.metadata.MetaDataManager.loadAnnotationsForClass(MetaDataMa 
> > nager.java:
> > 2278)
> >        at
> > org.datanucleus.metadata.MetaDataManager.loadClasses(MetaDataManager.java:
> > 385)
> >        at
>
> > org.d

[appengine-java] Re: Generic type in GAE JDO. Howto?

2010-02-12 Thread datanucleus
> java.util.HashMap is not supported, isn't it? I'm using Google plugin
> for Eclipse.

You get this exception from WHERE? i.e please provide the full
exception and stack trace. JDO supports persisting a HashMap clearly,
as per the spec

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Generic type in GAE JDO. Howto?

2010-02-12 Thread datanucleus
Also what is this @Element annotation on a Map ? A Map has no
elements; it has keys and values.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.