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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:57:25+00:00 2026-06-07T16:57:25+00:00

The model class: @Entity @Table(name = CSU_AUDIT) @NamedQuery(name = findAllEventsForObjectId, query = from AuditEvent

  • 0

The model class:

@Entity
@Table(name = "CSU_AUDIT")
@NamedQuery(name = "findAllEventsForObjectId", query = "from AuditEvent e where e.objectId = :objectId order by e.auditTimestamp desc")
public class AuditEvent implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = 577051869176721340L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int auditId;

    @Column(name = "INSERT_TS")
    private Date auditTimestamp;

    @Column(name = "OBJECT_ID")
    private String objectId;

    @Column(name = "ACTION_CODE")
    private String actionCode;

    @Column(name = "USER_ID")
    private String userId;

    @Column(name = "FIELD_NAME")
    private String fieldName;

    @Column(name = "OLD_VALUE")
    private String oldValue;

    @Column(name = "NEW_VALUE")
    private String newValue;

The simple DAO method:

public void insertEvent(AuditEvent event) {
        final Session session = sessionFactory.getCurrentSession();
        session.beginTransaction();
        log.info("Saving audit event...");
        log.debug(event);
        session.save(event);
        session.getTransaction().commit();
    }

The session factory is managed by Spring’s AnnotationSessionFactoryBean.

Relevant exception info (more available, if necessary):

2012-07-12 09:01:41,049 DEBUG org.hibernate.event.def.AbstractSaveEventListener - executing identity-insert immediately
2012-07-12 09:01:41,053 DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2012-07-12 09:01:41,066 DEBUG org.hibernate.SQL - insert into CSU_AUDIT (auditId, ACTION_CODE, INSERT_TS, FIELD_NAME, NEW_VALUE, OBJECT_ID, OLD_VALUE, USER_ID) values (default, ?, ?, ?, ?, ?, ?, ?)
2012-07-12 09:01:41,100 DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2012-07-12 09:01:41,117 DEBUG org.hibernate.util.JDBCExceptionReporter - could not insert: [com.cinfin.ecm.csudocmgr.audit.AuditEvent] [insert into CSU_AUDIT (auditId, ACTION_CODE, INSERT_TS, FIELD_NAME, NEW_VALUE, OBJECT_ID, OLD_VALUE, USER_ID) values (default, ?, ?, ?, ?, ?, ?, ?)]
com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703, SQLERRMC: AUDITID

I don’t understand why the field annotated as @ID and @GeneratedValue(strategy = GenerationType.IDENTITY) is being included in the insert. Everything I’ve read indicated that hibernate should omit this field entirely. On the database side this field is to be generated as identity, though I don’t have the generation code to know for sure how it has been declared.

  • 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-07T16:57:27+00:00Added an answer on June 7, 2026 at 4:57 pm

    As you see in the logs, it passes default as the value for the generated column, which means: use the default value for this column. DB2’s documentation says:

    DEFAULT

    Specifies that the default value is to be used. The result of specifying DEFAULT depends on how the column was defined, as follows:

    […]

    • If the IDENTITY clause is used, the value is generated by the database manager.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following model classes: @Entity @Table(name = title) public final class Title
I have a Model: @Entity @Table(name = User) public class User implements Serializable {
Here is the BlogPost model : @Entity @Table(name = blog_posts) public class BlogPost extends
I am using Hibernate with spring. I have a model-class like this. @Entity @Table(name
I'm using Ebean, and define such a model: @Entity @Table(name = users) public class
I want to use Services(WCF/RIA /Web) to take data from Entity Data Model class
I attempt to use webservice return POCO class generated from entity data model as
Confronted with the problem - ////////////////// GbCapacityEntity class ////////////////// @Entity @Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.NONE) @Table(name
Imagine, an Event entity references a Status Entity: @Entity @Table(name = event) public class
I have a parent-child relationship: @Entity @Table(name = user) public final class User {

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.