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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:53:13+00:00 2026-05-19T00:53:13+00:00

I am using Hibernate 3 as my persistence framework. Below is the sample hbm

  • 0

I am using Hibernate 3 as my persistence framework.
Below is the sample hbm file I am using.

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
     "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
     "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

    <hibernate-mapping>
      <class name="com.test.User" table="user">
      <meta attribute="implements">com.test.dao.interfaces.IEntity</meta>
      <id name="key" type="long" column="user_key">
            <generator class="increment" />
      </id>
     <property name="userName" column="user_name" not-null="true" type="string" />
     <property name="password" column="password" not-null="true" type="string" />
     <property name="firstName" column="first_name" not-null="true" type="string" />
    <property name="lastName" column="last_name" not-null="true" type="string" />
    <property name="createdDate" column="created_date" not-null="true" type="timestamp"     insert="false" update="false" />
   <property name="createdBy" column="created_by" not-null="true" type="string"  update="false" />
  </class>
</hibernate-mapping>

I am added a post-update listener. What it will do is if there any updations perfomed on User then it will be invoked and cahnges will be inserted to audit table.

Below is the sample implementation for postupdate event.

public void onPostUpdate(PostUpdateEvent event)
{
LogHelper.info(logger, "Begin - onPostUpdate "
    + event.getEntity().getClass().getSimpleName());
if (!this.checkForAudit(event.getEntity().getClass().getSimpleName()))
{
 // check do we need to audit it.
}

// Get Attribute Names
String[] attrNames = event.getPersister().getEntityMetamodel()
    .getPropertyNames();
Object[] oldobjectValue = c
Object[] newObjectValue = event.getState();

this.auditDetailsEvent(attrNames, oldobjectValue, newObjectValue);
LogHelper.info(logger, "End - onPostUpdate");
// return false;
}

Here is my requirement. event.getPersister().getEntityMetamodel()
.getPropertyNames(); or event.getOldState(); or event.getState();

must return attribute names or value which i can update or insert.

Is there any way to control the return values of above one’s.

Pleas help me on this regard.

Thanks,

Narendra

  • 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-19T00:53:14+00:00Added an answer on May 19, 2026 at 12:53 am

    The Problem Can be solved versy simply by using PostInsertEvent.getPersister().getPropertyInsertability();

    It will return a boolean array . So by checking this array we can identify is it necessaty to insert them in audit table or not.

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

Sidebar

Related Questions

I'm currently developping an application in java using Hibernate as a persistence manager and
I'm using hibernate validator framework with Spring. A class implementing the Spring Validator validates
I am using Hibernate 3.x, MySQL 4.1.20 with Java 1.6. I am mapping a
I am using Hibernate in a Java application to access my Database and it
I am currently using Hibernate Tools 3.1; I customized naming convention and DAO templates.
I'm using Hibernate for ORM of my Java app to an Oracle database (not
So I'm using hibernate and working with an application that manages time. What is
We are using Hibernate 3.1 with Spring MVC 2.0. Our problem occurs when data
I'm using Hibernate with Spring in my application. I have been consistently using detached
I'm using hibernate 3 and want to stop it from dumping all the startup

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.