These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: PK padding prevents update following insert
PostPosted: Thu Aug 18, 2005 3:18 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Hibernate version:

3.0.5 prod

Name and version of the database you are using:

Informix 9.x

The user must be able to insert, then update an object to a table where the PK is a char(2) (no, I did not design it). If the ID property is set to '5', the DB result ends up as a row w/ PK = '5 ', notice the space. Hibernate then cannot update changes to the same object it has inserted - see stack trace. The work around is to save, *retrieve*, and then let the user update. Is this expected behavior?

Full stack trace of any exception that occurs:

11:09:11,746 INFO [STDOUT] org.hibernate.HibernateException: identifier of an instance of gov.blm.ak.arims.generated.Gear altered from 5 to 5
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:51)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:82)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at gov.blm.ak.hibernate.Hibernate3Util.commitTransaction(Hibernate3Util.java:128)
at gov.blm.ak.hibernate.HibernateTool.saveOrUpdate(HibernateTool.java:78)
at gov.blm.ak.hibernate.HibernateTool.update(HibernateTool.java:92)
at gov.blm.ak.hibernate.HibernateTool.update(HibernateTool.java:106)
at gov.blm.ak.arims.backing.crud.GearCrudBacker.update(Unknown Source)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 4:24 am 
Newbie

Joined: Sat Aug 13, 2005 4:48 am
Posts: 5
Location: Pakistan
The database shouldnt do that. The only solutions I can see is you should insert the objects with a space so that the keys in the db match object key.

_________________
Custom Software and Custom Website Design
Dont forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 12:08 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Negative ghostrider. The Db *has* to do this.

http://publib.boulder.ibm.com/infocente ... mst104.htm


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.