simpatico
simpatico

Reputation: 11087

Are @ManyToMany relationships not allowed in GAE?

My understanding is that with GAE JPA support I cannot:

@ManyToMany
    private Set<SSUser> contacts; 

    protected SSUser(){}

    public SSUser(final String userId, final String emailId){
        this.userId = userId;
        this.emailId = emailId;
        contacts = new HashSet<SSUser>();
    }

I'm trying to establish a contacts relationship. Did I correctly understand that the above is not allowed?

If so, would Set<String> contactsIds be allowed? Could I be provided a working example?

Upvotes: 3

Views: 834

Answers (2)

Pascal Thivent
Pascal Thivent

Reputation: 570305

From the online documentation about what the datastore doesn't support:

Unsupported Features of JPA 2.0

The following features of the JPA interface are not supported by the App Engine implementation:

  • Owned many-to-many relationships
  • "Join" queries. You cannot use a field of a child entity in a filter when performing a query on the parent kind. Note that you can test the parent's relationship field directly in query using a key.
  • Aggregation queries (group by, having, sum, avg, max, min)
  • Polymorphic queries. You cannot perform a query of a class to get instances of a subclass. Each class is represented by a separate entity kind in the datastore.

Upvotes: 1

simpatico
simpatico

Reputation: 11087

Yes, they are not allowed.

Set contactsIds be allowed? Could I be provided a working example?

It works, see: http://screenshoter.svn.sourceforge.net/viewvc/screenshoter/screenshoter/trunk/SS-server/src/com/mysimpatico/ss/server/SS_serverServlet.java?revision=8&view=markup

Upvotes: 2

Related Questions