How to remove DEFAULT keyword for IDENTITY column from auto generated insert script in DB2 database?

Solution Verified - Updated -

Issue

  • We're using a DB2 LINUX (10.5 FP5) DB federation server and created nicknames that are in fact Synonyms to MS SQL 2012 Tables. All this is working correctly (SELECT, INSERT, UPDATE, DELETE, etc.).

  • In Java applications, developers are using DB2Dialect.

  • The problem we have is related to the INSERT statements currently generated by Hibernate.

  • Is it possible to remove an IDENTITY COLUMN of default keyword from the INSERT statements ?

  • The SQL statement generated by Hibernate is :

2015-04-13 13:30:48,015 INFO [STDOUT] Hibernate: insert into MY_TABLE (ID, FIELD_ONE, FIELD_TWO) values (default, ?, ?)
2015-04-13 13:30:48,040 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: -30090, SQLState: 25000
  • This kind of statement will work with DB2 Table but not with a DB2 Nickname pointing to a MS SQL Table.

Environment

  • Red Hat JBoss Enterprise Application Platform 6
  • Hibernate 4
  • IBM DB2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content