开发者

Are @ManyToMany relationships not allowed in GAE?

开发者 https://www.devze.com 2023-01-10 18:03 出处:网络
My understanding is that with GAE JPA support I cannot: @ManyToMany private Set<SSUser> contacts;

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?


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


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号