Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8133643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:40:53+00:00 2026-06-06T09:40:53+00:00

I am writing small app, using Play Framework 2.0 which uses Ebean as ORM.

  • 0

I am writing small app, using Play Framework 2.0 which uses Ebean as ORM.
So I need many-to-many relationship between User class and UserGroup class.
Here is some code:

@Entity
public class User extends Domain {

    @Id
    public Long id;
    public String name;

    @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    public Set<UserGroup> groups = new HashSet();
}



@Entity
public class UserGroup extends Domain {

    @Id
    public Long id;     
    public String name;

    @ManyToMany(mappedBy="groups")
    public Set<User> users = new HashSet();
}

Database scheme generator generates good scheme for that code with intermediate table and all work quite ok, till I using many-to-many.

So I am adding group in one request:

user.groups.add(UserGroup.find.byId(groupId));
user.update();

And trying output them to System.out in another:

System.out.println(user.groups);

And this returns:

BeanSet deferred

Quick search show that BeanSet is lazy-loading container from Ebean. But seems like it doesn’t work in proper way or I missed something important.

So is there any ideas about what I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:40:54+00:00Added an answer on June 6, 2026 at 9:40 am

    You need to save associations manually

    user.groups.add(UserGroup.find.byId(groupId));
    user.saveManyToManyAssociations("groups");
    user.update();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been writing a small Facebook app which uses the unified_thread table using FQL.
I'm writing a small Java app using JavaMail that sends the user an automated
I am writing a small app which I need to test with utf-8 characters
I am writing a small app ( initApp.js , initApp.routinj.js , initApp.controller.js ) which
I am writing a small app in which android device tries to send a
I am writing a small app that uses the GAE. I have parts of
I'm currently writing a small python app that embeds cherrypy and django using py2app.
I am currently writing a small web app using Asp.net MVC and jQuery mobile.
I'm writing a small sample app using Ember.js. My goal is to determine use
I am writing a small shoutbox/chat app where I am using the following piece

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.