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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:04:11+00:00 2026-05-25T17:04:11+00:00

I am using Java and Hibernate in my project. I am facing a very

  • 0

I am using Java and Hibernate in my project. I am facing a very peculiar problem. Whenever i load an entity, select in not fired on the database, instead whenever i perform some operation on object like get some value, at that time it fires the select which is called lazy loading. But the problem is i have not stated lazy="true" in my HBM file. Also sometimes, load is successful, and then when i try to do some manipulation on the object it gives an error, ProxyInitializationError Session is Closed.

Can check the below link for code base :-
http://pastebin.com/yD9ZM3yH

But if in the actual method i put System.out.println(information.getStudentName()); then the code works properly as the select is fired before the session was closed.

Regards

  • 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-25T17:04:12+00:00Added an answer on May 25, 2026 at 5:04 pm

    This is normal behiavior.

    when you are using session.load(Object.class, id)the returned object is proxy class.
    Just look at my answer here:

    What does Hibernate's load() method do for non-existing IDs?

    2) you are receiving this error, because as soon as you received your proxy, Hibernate session is closed and proxy initiation throws this exception.

    You can read more about it and possible solutions in this technical article.

    http://community.jboss.org/wiki/OpenSessionInView

    Hope it helps.

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

Sidebar

Related Questions

I'm using Hibernate for ORM of my Java app to an Oracle database (not
I am a Java programmer and was working on a project using Hibernate and
I have made an application using Java/Hibernate/MySQL, but whenever I try running it, it
I am using Hibernate in a Java application to access my Database and it
I'm using Spring and Hibernate in a Java-EE application. The project is hosted at
When trying to optimize transactions on my java ee 6 project using hibernate, I
Our current project does not use Hibernate (for various reasons) and we are using
i have spring project under java, using hibernate query, i like to use pessimistic
I am learning JPA w/Hibernate using a Java SE 6 project. I'd simply like
I am using maven2 with a struts-hibernate Java EE project and developing with myEclipse.

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.