Thanks in andvance for any help.
We are inserting rows into DB2. We use JBoss and Spring. When we insert these rows and then ask for the identity number ont DB2/NT everything works fine. When we use DB2 OS/390 we get the error listed below. As if the identity is alway returning null or 0.
This is on one of our customer's machines so I'm waiting on more logging.
Again, this works fine on DB2/NT, Oracle, Sql Server, etc. Problem only happens on OS/390.
The DB2390Dialect has been around for years, so it must be something with our configuration. Is there anything special that needs to be done?
Thanks again...
Hibernate version:3.2.6
Mapping documents:<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="dars.apis.audit.JobQueueSysin"
table="job_queue_sysin"
lazy="false"
>
<meta attribute="pre-class-code">@SuppressWarnings("serial")</meta>
<meta attribute="generated-class" inherit="false">dars.apis.audit.BaseJobQueueSysin</meta>
<id
name="intSeqNo"
type="java.lang.Integer"
column="int_seq_no"
>
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<meta attribute="use-in-equals">true</meta>
<generator class="native">
<param name="sequence">jobqsi_seq_no</param>
</generator>
</id>
.
.
.
Code between sessionFactory.openSession() and session.close():Just getHibernateTemplate().save(object); //Spring
Full stack trace of any exception that occurs:org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [dars.apis.audit.JobQueueSysin#0]
at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:590)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:303)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:334)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:702)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:374)
... 45 more
Name and version of the database you are using:DB2 OS/390
The generated SQL (show_sql=true):
2008-07-28 09:34:12,956 DEBUG [org.hibernate.SQL] select jobqueueli_.instidq, jobqueueli_.instid, jobqueueli_.instcd, jobqueueli_.jobid, jobqueueli_.userid, jobqueueli_.status as status2_, jobqueueli_.priority as priority2_, jobqueueli_.startdate as startdate2_, jobqueueli_.starttime as starttime2_, jobqueueli_.external_eval as external10_2_, jobqueueli_.read_sysin as read11_2_, jobqueueli_.servername as servername2_, jobqueueli_.last_mod_user as last13_2_, jobqueueli_.last_mod_date as last14_2_ from job_queue_list jobqueueli_ where jobqueueli_.instidq=? and jobqueueli_.instid=? and jobqueueli_.instcd=? and jobqueueli_.jobid=? and jobqueueli_.userid=?
2008-07-28 09:34:13,418 DEBUG [org.hibernate.SQL] select jobqueueli0_.instidq as instidq2_, jobqueueli0_.instid as instid2_, jobqueueli0_.instcd as instcd2_, jobqueueli0_.jobid as jobid2_, jobqueueli0_.userid as userid2_, jobqueueli0_.status as status2_, jobqueueli0_.priority as priority2_, jobqueueli0_.startdate as startdate2_, jobqueueli0_.starttime as starttime2_, jobqueueli0_.external_eval as external10_2_, jobqueueli0_.read_sysin as read11_2_, jobqueueli0_.servername as servername2_, jobqueueli0_.last_mod_user as last13_2_, jobqueueli0_.last_mod_date as last14_2_ from job_queue_list jobqueueli0_ where jobqueueli0_.servername=? and (userid like ?) and (jobqueueli0_.status in ('D' , 'E'))
2008-07-28 09:34:16,119 DEBUG [org.hibernate.SQL] insert into job_queue_list (status, priority, startdate, starttime, external_eval, read_sysin, servername, last_mod_user, last_mod_date, instidq, instid, instcd, jobid, userid) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2008-07-28 09:34:18,095 DEBUG [org.hibernate.SQL] insert into job_queue_sysin (int_seq_no, user_seq_no, sysin, instidq, instid, instcd, jobid, userid) values (default, ?, ?, ?, ?, ?, ?, ?)
2008-07-28 09:34:18,406 DEBUG [org.hibernate.SQL] select jobqueueli0_.instidq as instidq2_, jobqueueli0_.instid as instid2_, jobqueueli0_.instcd as instcd2_, jobqueueli0_.jobid as jobid2_, jobqueueli0_.userid as userid2_, jobqueueli0_.status as status2_, jobqueueli0_.priority as priority2_, jobqueueli0_.startdate as startdate2_, jobqueueli0_.starttime as starttime2_, jobqueueli0_.external_eval as external10_2_, jobqueueli0_.read_sysin as read11_2_, jobqueueli0_.servername as servername2_, jobqueueli0_.last_mod_user as last13_2_, jobqueueli0_.last_mod_date as last14_2_ from job_queue_list jobqueueli0_ where jobqueueli0_.servername=? and (userid like ?) and (jobqueueli0_.status in ('D' , 'E'))
2008-07-28 09:34:18,781 DEBUG [org.hibernate.SQL] select identity_val_local() from sysibm.sysdummy1
2008-07-28 09:34:18,801 DEBUG [org.hibernate.SQL] insert into job_queue_sysin (int_seq_no, user_seq_no, sysin, instidq, instid, instcd, jobid, userid) values (default, ?, ?, ?, ?, ?, ?, ?)
2008-07-28 09:34:18,828 DEBUG [org.hibernate.SQL] select identity_val_local() from sysibm.sysdummy1
Debug level Hibernate log excerpt:
Problems with Session and transaction handling? Maybe?