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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:54:26+00:00 2026-06-12T10:54:26+00:00

I have been moving a project from JPA to Hibernate native implementation (got outvoted

  • 0

I have been moving a project from JPA to Hibernate native implementation (got outvoted by team :<).

One of the fabulous things I have to deal with is that @PostLoad does not work with Hibernate native library. So I Googled a bit.

First I looked into EventListeners -> Nope, the Configuration class no longer seems to let you set it. And when I injected it in the cfg file, the listeners still refuse to work.

Okay, next, I looked into Interceptors -> Nope, no post-load. instantiate also doesn’t pass in the object itself. How convenient.

And then finally, I looked into LifeCycle -> Wow yes, it has onLoad(), but it passes in the Session and a Serializable Id but no object. Nice.

Anyway, all I want is something that listens for post-load with a handler function called onPostLoad(Object object, yadda yadda yadda). Does anyone have a good suggestion?

  • 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-12T10:54:27+00:00Added an answer on June 12, 2026 at 10:54 am

    Interceptors do have an onLoad() method. Have you checked into that? Its signature looks like this:

    @Override
    public boolean onLoad(Object entity, Serializable id, Object[] state,
            String[] propertyNames, Type[] types) {
        // TODO Auto-generated method stub
        return super.onLoad(entity, id, state, propertyNames, types);
    }
    

    Note that if you change a property in the entity, you will have to return true, and return false otherwise (say you are simply counting entities, for example).

    If you are using Spring, you will wire your interceptor in like this:

    <bean id="sessionFactory"       class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="entityInterceptor">
            <bean class="my.company.MyInterceptor"/>
        </property>
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a legacy java project that we have been moving to buildr/artifactory from
i have been working on moving one of my apps away from the shared
I have been moving my Java projects from Jdeveloper over to Eclipse whenever I
I've been moving a fairly new project from ViewPages to Razor today, and all
I'm a Flash developer but have been slowly moving to developing my applications in
We have been using gforge server for cvs/svn. Now we are moving to git.
I have a new clustered database and I've been moving data into the tables
I am currently moving into the web-hosting league. I have to far been adding
I am currently moving an ASP.NET web-project from an IIS 6 to a IIS
I have been tasked with taking an Access 97 application and moving the back-end

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.