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 8003897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:46:24+00:00 2026-06-04T16:46:24+00:00

I’m using the PlayFramework and I’m really liking it. When I want to grab

  • 0

I’m using the PlayFramework and I’m really liking it. When I want to grab data from a table, for example I have a user table, I use the following syntax:

List<User> users = User.find.where().eq("email", email).findList();

My question is that when I get the user object, I have an id column. With that id value I can map to other tables and the id‘s of those tables can be mapped to even more tables, so basic concept of joining across several tables. Is there any example or place I can read where it describes how to implement that with the above-like syntax?

I tried to find myself and couldn’t, only way I can think of it at this point is to use straight sql with prepared statements which I’d rather not do.

  • 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-04T16:46:27+00:00Added an answer on June 4, 2026 at 4:46 pm

    ellou’ kalvish

    Relationships between models are set with common JPA annotations like @OneToMany, @ManyToOne, @OneToOne, etc.

    So if you have User.java model for user table and Question.java model for user’s Question you can join them with @OneToMany (One User has Many Questions)

    User

    @Entity
    public class User extends Model {
        @Id
        public Long id;
    
        public String email;
    
        @OneToMany
        public List<Question> questions;
    }
    

    Question

    @Entity
    public class Question extends Model {
        @Id
        public Long id;
    
        public String question;
    }
    

    When you’ll select a User in controller, Ebean will perform ‘joins’ by default and will fetch all user’s questions as well:

    User user = User.find.where().eq("email", email).findUnique();
    List<Question> usersQuestion = user.questions;
    

    By default Ebean fetches all object’s properties and relations, so you don’t need to create subqueries. Of course you can or even should select/fetch only the data that is required at the moment.

    At the official Ebean documentation page you’ll find quite good Reference guide (pdf), general description of relationship is available in section 11.6.2 Relationships.

    In section 4.1.2 Query there is example (second) which demonstrates how to get “partial” object with use of select() and fetch()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I want to construct a data frame in an Rcpp function, but when I
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have some data like this: 1 2 3 4 5 9 2 6
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.