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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:26:34+00:00 2026-05-31T23:26:34+00:00

I am writing a web application (Tomcat 7) so no JTA and want to

  • 0

I am writing a web application (Tomcat 7) so no JTA and want to display a list of projects including the tasks associated to each project in a JSF page.

There are 2 entities – Project which contains a Collection of Tasks. From my Managed Bean I call a convenience method to retrieve all the active the Projects, then iterate (ui:repeat) over this Collection of Projects and want to display the Tasks per Project. When I try t do this I get a Persistence Exception since the Persistence Context is no longer in scope.

Without creating backing beans of the Project and Task and without making use of an Extended Context what other options do I have.

  • 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-05-31T23:26:35+00:00Added an answer on May 31, 2026 at 11:26 pm

    Have your convenience method also fetch the tasks, for instance by joining that association in the query? If the task are already loaded, JPA won’t need to fetch them when you access the collection.

    Edit: The JPA 2.0 specification writes in section 4.4.5.3:

    A FETCH JOIN enables the fetching of an association or element collection as a side effect of the execution of a query.

    The syntax for a fetch join is

    fetch_join ::= [ LEFT [OUTER] | INNER ] JOIN FETCH join_association_path_expression
    

    The association referenced by the right side of the FETCH JOIN clause must be an association or element collection that is referenced from an entity or embeddable that is returned as a result of the query.

    It is not permitted to specify an identification variable for the objects referenced by the right side of the FETCH JOIN clause, and hence references to the implicitly fetched entities or elements cannot appear elsewhere in the query.

    The following query returns a set of departments. As a side effect, the associated employees for those departments are also retrieved, even though they are not part of the explicit query result. The initialization of the persistent state or relationship fields or properties of the objects that are retrieved as a result of a fetch join is determined by the metadata for that class — in this example, the Employee entity
    class.

    SELECT d 
    FROM Department d LEFT JOIN FETCH d.employees
    WHERE d.deptno = 1
    

    A fetch join has the same join semantics as the corresponding inner or outer join, except that the related objects specified on the right-hand side of the join operation are not returned in the query result or otherwise referenced in the query. Hence, for example, if department 1 has five employees, the above query returns five references to the department 1 entity.

    The FETCH JOIN construct must not be used in the FROM clause of a subquery.

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

Sidebar

Related Questions

I'm writing a JSF 2.1 web application, which is hosted by Tomcat 6. At
I'm writing web application with using Spring, Velocity and Tomcat as container. My problem
I am writing a web application to be deployed on tomcat . I am
I am writing a web application with Struts 3 using Tomcat 7 with Eclipse.
I'm testing a JBoss / Tomcat web application, writing JavaScript tests in .js files.
I have a Java web application running on Tomcat. I want to load static
I'm writing a web-application in Python, I haven't decided if I want to use
I'm writing a Web Application based on Tomcat and Java Servlets. In my case,
I'm contemplating writing a web application with Rails. Each request made by the user
I am writing a web application using PHP. I want to use the MVC

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.