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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:20:57+00:00 2026-06-04T04:20:57+00:00

I am starting to learn Play Framework 2, and have met a strange problem.

  • 0

I am starting to learn Play Framework 2, and have met a strange problem.

I have a OneToMany relationship defined between a Project and its many Tasks.

@Entity
public class Project extends Model {
    @OneToMany(mappedBy="project", cascade=CascadeType.ALL)
    public List<Task> tasks = new ArrayList<Task>();
}

@Entity
public class Task extends Model {
    @ManyToOne
    public Project project;
}

I have some code that finds and displays a Project :

final Project foundProject = Project.find(id);
//Logger.error("Tasks size:"+foundProject.tasks.size());
return ok(views.html.tasks.render(foundProject, taskForm));

And a view:

@for(task <- project.tasks) {
    <li>@task.title</li>
}

Note the commented-out Logger line in the code that finds the Project. If that line is commented out, then no Tasks are shown, if the line is NOT commented out, then Tasks are shown.

It’s as if some kind of lazy initialisation code works inside the Controller but not inside the View. Is there a subtlety of Play that I have missed, or am I doing something 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-04T04:20:58+00:00Added an answer on June 4, 2026 at 4:20 am

    It was my fault – I’m new to eBean and was doing this in the code to find my project:

    finder.ref(id);
    

    instead of:

    finder.byId(id);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting to learn JavaScript, so far no problem but I have a hard
Just starting to learn scala for a new project. Have got to the point
I'm just starting to learn AspectJ, and I have use-case for say, User login.
I am starting to learn jQuery. Looking though the MVC3 project that makes use
so I am starting to learn how to develop Android Applications. I have experience
I am starting to learn codeigniter and the whole MVC framework. What im looking
I am starting to learn PHP and have a decent Java background. I came
i'm just starting to learn about database design. For my first project I made
I am starting to learn python. I have gone through several tutorials and now
I'm just starting to learn Python and have heard about the GIL and how

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.