-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem with updating - select scope_identity()
PostPosted: Mon May 15, 2006 5:26 am 
Regular
Regular

Joined: Sun Jan 18, 2004 9:43 am
Posts: 50
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.2


Full stack trace of any exception that occurs:
ERROR 2006-05-15 17:08:10,671 [AWT-EventQueue-0] (BatchingBatcher.java:61) - Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1



Name and version of the database you are using: Ms SQL 2000


I am using Hibernate in a standalone program. The above problem only happens when it updates an existing records but not saving a new records.

Not all updates are failed, only when I saw the following "insert" query get genereated. This query is generated when I call session.createQuery(hql). I don't understand what does the following sql mean and also don't know how to make hibernate not to generate the it. Please help!


The generated SQL (show_sql=true):
Hibernate: insert into erp.dbo.PlasticCostLine (fitting_id, table_id, cost_type_id, composite_id, nums, cost, memo) values (?, ?, ?, ?, ?, ?, ?) select scope_identity()





Kind regards

_________________
Edmond Hung
Credit Card DNA Security System (Holdings) Ltd.


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

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.