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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:26:11+00:00 2026-05-28T20:26:11+00:00

Error: org.hibernate.LazyInitializationException SEVERE: could not initialize proxy – the owning Session was closed Code:

  • 0

Error:

org.hibernate.LazyInitializationException SEVERE: could
not initialize proxy – the owning Session was closed

Code:

System.out.println(resultStudent.getStudentAddress().getCity());

Here the getAddress() returns an Address object and i am trying to get the city of the student using getCity() of Address class. Why do I get the above error?

Just getting the Address object doesn’t throw any error.

  • 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-28T20:26:13+00:00Added an answer on May 28, 2026 at 8:26 pm

    Hibernate loads the relationships lazily. So when you are navigating the relationship you need to either have the hibernate session open or fetch the data eagerly. Read the below articles

    1. Understanding Lazy Fetching
    2. Fetch strategies
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this Hibernate error: org.hibernate.MappingException: Could not determine type for: a.b.c.Results$BusinessDate, for columns:
Despite using configuration below I got lazy initialize error: org.hibernate.LazyInitializationException: failed to lazily initialize
I am getting the following error org.springframework.orm.hibernate3.HibernateSystemException: could not deserialize; nested exception is org.hibernate.type.SerializationException:
I get error org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP
this is the error org.hibernate.hql.ast.QuerySyntaxException: Payment is not mapped [select p from Payment p]
I am running into the org.hibernate.LazyInitializationException error when I try to access a lazy
I'm trying to run a simple Hibernate application, but I get this error: org.hibernate.exception.SQLGrammarException:
Problem: 12:03:10,126 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - schema export unsuccessful org.hibernate.HibernateException: JDBC Driver class not found:
I get this error, when trying to connect two table via manytomany: ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate]
[hannel,192.168.0.46:40014] 15:08:03,642 - ERROR - org.jgroups.protocols.UDP - failed sending message to null (61 bytes)

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.