I have a one to many relationship in which I'd like to store the
"many" side in a sorted set, e.g. :


@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class Foo {
    @Persistent(mappedBy = "foo")
    private SortedSet<Bar> bars;
}

The datanucleus documentation indicates that there is an extension
named "comparator-name" that should allow me to specify the comparator
to use for the given sorted set. Thus, my first pass at this was:

 @Persistent(mappedBy = "foo")
 @Extension(vendor="datanucleus", key="comparator-name"
value="foo.bar.MyComparatorClass")
 private SortedSet<Bar> bars;

  Alternatively, since I wasn't sure where the @Extension should be
marked, I also tried:

@Persistent(
            mappedBy = "foo",
            extensions = {
                @Extension(vendor="datanucleus", key="comparator-name"
value="foo.bar.MyComparatorClass")
            }
)
 private SortedSet<Bar> bars;

However, in both cases my application blows up with a class cast
exeption  and JDO reports that Bar does not implement Comparable.

What is the correct way to specify this extension so that JDO can use
the correct comparator for the SortedSet ?

-- 
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-java@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.

Reply via email to