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

  • Home
  • SEARCH
  • 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 4117508
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:50:37+00:00 2026-05-20T22:50:37+00:00

Using Glassfish 3.1 with Eclipselink as JPA provider on board. Got stateless bean with

  • 0

Using Glassfish 3.1 with Eclipselink as JPA provider on board. Got stateless bean with following code and Folder class wich is mapped to table. Each folder can have it’s parent folder.

Stateless bean got following code.

 @TransactionAttribute(TransactionAttributeType.REQUIRED)
   public List<Folders> getUserFolders() {
    return folderDao.findFolders();
   }

And entity class

public class Folder {

    @ManyToOne(fetch=FetchType.LAZY)
    private Folder parent;

    @OneToMany(targetEntity=Folder.class, mappedBy="parent", fetch=FetchType.LAZY)
    private List<Folder> childFolders;

}

Consider following situation, Servlet invoke this bean to get all folders and iterate in cycle over the folder invoking getChildFolders() method.

FINEST: Connection acquired from connection pool [read].
FINEST: reconnecting to external connection pool
FINE: SELECT ID, FOLDERNAME, POSITION, OWNER_ID, PARENT_ID FROM t_user_folder WHERE (PARENT_ID = ?)
    bind => [1 parameter bound]
FINEST: Connection released to connection pool [read].

Invocation of method getChildFolders() occurs outside of transactional method, persistent context is flushed already. And I can’t understand why LazyInitializationException does not throw and how container does know from where he should obtain connection. Can someone explain it please

  • 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-20T22:50:38+00:00Added an answer on May 20, 2026 at 10:50 pm

    Well, this situations arises from eclipselink architecture.. Eclipselink JPA implementation stil uses legacy Toplink session architecture.. There is one global server session, for non-transactional operations a new client-session is spawned from this server session, for transactional operations a UnitOfWork session is spawned.. In your case, there is no need for transaction, because it is just a read operation… But if you change your entity and call merge method , you would get Exception.. For more information, you can read this link

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

Sidebar

Related Questions

I'm implementing stateless session bean ejb3 in glassfish server using netbeans. First time, it
I am using Glassfish v3 server. Usually the DB connection with EJB3 + JPA
Has anyone got EclipseLink MOXy (I'm using eclipselink 2.1.0) to work with Java 5?
I'm using Glassfish in production and OpenEJB in testing. I'm using JPA 1.0. I'm
Got Ejb @Stateless @Local public class UserManagerBean implements UserManagerBeanLocal { @TransactionAttribute(TransactionAttributeType.REQUIRED) public Long registerUser(User
Using C#, I need a class called User that has a username, password, active
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I am trying to get a simple example up and running using JPA in
I'm working on a web project using EJB 3.0, and whenever EclipseLink tries to
I'm using Glassfish and Toplink together with an MS-SQL-Server, thus sqljdbc4.jar is used for

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.