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 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

When using Persistence frameworks like Hibernate, JPA etc. on the server side, what are
I am using hibernate as a persistence layer. There are 2 entities that live
I'm currently developping an application in java using Hibernate as a persistence manager and
we are developing a J2SE application and we are using Hibernate for our persistence
I am a newbie in hibernate, I am using @javax.persistence.NamedNativeQuery to resolve my stored
I have an application using Hibernate for data persistence, with Spring on top (for
I'm just starting to learn Java database persistence using Hibernate ORM and have run
I have a hibernate project, which uses JPA. my persistence.xml contents is as follows:
I am using hibernate framework to be able to use Oracle or Sybase (customer
I am using nhibernate for my OR persistence and I store a list of

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.