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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:27:36+00:00 2026-06-08T09:27:36+00:00

i use spring3 with hibernate3 and jsf2 with primefaces.. I have a problem when

  • 0

i use spring3 with hibernate3 and jsf2 with primefaces..

I have a problem when i try to load data from the db , i get null pointer Exception as the session factory is null !

I think the problem comes from :

when i made my managedBean in the viewscoped it gives me “Not serializable Exception” so i make all the class members implement serialaizable but it also gives me the not serializable Exception but for this class “org.springframework.orm.hibernate3.LocalSessionFactoryBean” , so i made the session factory transient .

after i made the session factory transient the application works fine but if i made ajax request the session factory is null so i have null pointer exception !!!

any help will be appreciated..

thanks inadvance

  • 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-06-08T09:27:38+00:00Added an answer on June 8, 2026 at 9:27 am

    Not really create a new session factory

    You are using spring so reference tree must be something

    ManagedBean -> Spring Service -> Spring Repository

    Your managed beans should have reference to a service layer(Singleton). This reference you should mark as transient and fetch from application context in method hooks.

    The service bean will always be available from context and you dont have to recreate any instance, its just you pick it back from context.

    As for hibernate, it should be in Repository layer and since you have protected your service layer from serialization Repository will not be serialized and hence no issue as above.

    @ViewScoped
    public class ManagedBean implements Serializable {
    
      @Autowired private transient Service service;
    
    }
    
    @Service
    public class ServiceImpl implements Service{
    
     @Autowired private Repository repository;
    
    }
    
    @Repository
    public class RepositoryImpl extends HibernateDaoSupport implements Repository {
    
      //here you can have hibernate session factory injected for dao support
    }
    

    Hope this helps !!!!!

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

Sidebar

Related Questions

I'm moving an application to use the Spring3 framework and I have code that
I use Spring Security 3 and JSF2 Primefaces. Then, I create a index.xhtml for
I use Spring 3.2 and Spring-security 3.1 along with jsf + primefaces and hibernate4
i had use the spring3.1 ibatis2.x and mysql5.5. then i wanna use the replication
I have an application that I use BoneCP for connection pooling and when I
My web project was working perfectly, it includes: spring3 and hibernate3 . After renaming
My web project was working perfectly, it includes: spring3 and hibernate3 . After renaming
I am using spring mvc3 and hibernate3. In my application i have a requirement
I have Spring MVC App integrated with Hibernate. Everything was OK until I use
We have a Hibernate/Spring application that have the following Spring beans: <bean id=transactionManager class=org.springframework.orm.hibernate3.HibernateTransactionManager

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.