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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:16:18+00:00 2026-05-11T18:16:18+00:00

I’m getting LazyInitializationException with session scoped bean in my service layer. If I load

  • 0

I’m getting LazyInitializationException with session scoped bean in my service layer. If I load the same bean using a regular dao in my method, I can access it’s lazy collections without problems. But if I inject it in my service bean, and then try to access one of its lazy collection, I have a LazyInitializationException.

I’m using JPA + Hibernate + Spring + struts. I have configured OpenEntityManagerInViewFilter. Futhermore, I can clearly see in the logs that the transaction and the session are opened.

Is there something special that I have to do in the configuration for session-scoped bean with lazy collections?

Here are the logs:

    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter:lookupEntityManagerFactory:146 - Using EntityManagerFactory 'entityManagerFactory' for OpenEntityManagerInViewFilter
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter:doFilterInternal:101 - Opening JPA EntityManager in OpenEntityManagerInViewFilter
    org.springframework.orm.jpa.JpaTransactionManager:doGetTransaction:285 - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@17ab5c0] for JPA transaction
    org.springframework.transaction.support.AbstractPlatformTransactionManager:getTransaction:371 - Creating new transaction with name [com.xx.action.spring.service.SearchService.loadCurrencyCode]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly
    org.hibernate.impl.SessionImpl:<init>:247 - opened session at timestamp: 5093202578464768
    org.hibernate.transaction.JDBCTransaction:begin:82 - begin
    org.hibernate.jdbc.ConnectionManager:openConnection:444 - opening JDBC connection
    org.hibernate.transaction.JDBCTransaction:begin:87 - current autocommit status: true
    org.hibernate.transaction.JDBCTransaction:begin:90 - disabling autocommit
    org.springframework.orm.jpa.JpaTransactionManager:doBegin:348 - Exposing JPA transaction as JDBC transaction [SimpleConnectionHandle: com.mchange.v2.c3p0.impl.NewProxyConnection@9b537f]
    org.hibernate.LazyInitializationException:<init>:42 - could not initialize proxy - no Session
    org.hibernate.LazyInitializationException: could not initialize proxy - no Session
        at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:86)
        at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:140)
        at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
        at com.xxx.api.jpa.bean.CurrencyBean_$$_javassist_29.getHtmlSymbol(CurrencyBean_$$_javassist_29.java)

Here are the configuration of the bean:

<bean id="currentUserBean" class="com.xxx.action.spring.CurrentUserBean" scope="session">
        <aop:scoped-proxy />    
</bean>    
  • 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-11T18:16:18+00:00Added an answer on May 11, 2026 at 6:16 pm

    Check out this thread:

    Spring Forum Discussion

    Well then try this one – really the same answer

    Better Spring Forum Discussion

    Seems the simplest solution is to set lazy=”false” in your hibernate mapping file, but there is a full answer there that will allow you to use LazyInitialization

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

Sidebar

Ask A Question

Stats

  • Questions 169k
  • Answers 169k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Incredible_Honk is almost right. The key is to use the… May 12, 2026 at 1:52 pm
  • Editorial Team
    Editorial Team added an answer The Customizing Existing Classes chapter of the Objective-C Programming Guide… May 12, 2026 at 1:52 pm
  • Editorial Team
    Editorial Team added an answer Try this string pathIntern = @"\\11fil01\brukar\" + user.UserName; DirectoryInfo diIntern… May 12, 2026 at 1:52 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.