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.  [ 2 posts ] 
Author Message
 Post subject: StaleState Issue: Command Status returned from insert
PostPosted: Thu Mar 06, 2008 5:31 pm 
Newbie

Joined: Mon Nov 05, 2007 12:12 pm
Posts: 5
Hibernate version:3.x
Full stack trace of any exception that occurs:
Code:
SEVERE  03/06/08 20:34:20.038 AbstractBatcher - Exception executing batch: org.hibernate.StaleStateException: Batch update returned unexpected
row count from update [0]; actual row count: 0; expected: 1
        at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
        at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
        at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
        at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2247)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
        at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
        at com.exagrid.triage.recv.compprot.CompressionProtectionParser.parseFile(CompressionProtectionParser.java:121)

Name and version of the database you are using:Postgres 8.2

Hi, I get the above error. I know the problem lies in the command status returned by postgres on the insert of new rows into the database. I am forcing postgres to redirect the insert of data on tableA to tableB (and c and d and e etc) depending on a certain ID.
I have rules set up to force this redirection. My question is about the command status, I was able to use the way the rules were executed in postgres while I only had one rule in effect (see this page for the methodology), however when a second rule was added, and the insert occured on the rule that was alphabetically NOT last, the results returned are for the very last rule which did not have an insert (INSERT 0 0 was returned).

Has anyone dealt with this? is there a way in hibernate to work with this behavior?

Here are my rules on the table:

Code:
Rules:
    __00__ver_chain_files AS
    ON INSERT TO ver_chain_files DO INSTEAD NOTHING

    insert_ver_chain_files_986e4156_cd7d_01db_39f8_001517106ba9 AS
    ON INSERT TO ver_chain_files
   WHERE new.cust_id::text = '986e4156-cd7d-01db-39f8-001517106ba9'::text DO INSTEAD  INSERT INTO ver_chain_files_986e4156_cd7d_01db_39f8_001517106ba9 (id, cust_id, gridfid, "sequence", txn_id, ishead, comp_type, comp_size, uncomp_size, comp_ratio, comp_percent, comp_time)
  VALUES (new.id, new.cust_id, new.gridfid, new."sequence", new.txn_id, new.ishead, new.comp_type, new.comp_size, new.uncomp_size, new.comp_ratio, new.comp_percent, new.comp_time)

    insert_ver_chain_files_d2ac03c0_6d03_01dc_f3a6_001517306488 AS
    ON INSERT TO ver_chain_files
   WHERE new.cust_id::text = 'd2ac03c0-6d03-01dc-f3a6-001517306488'::text DO INSTEAD  INSERT INTO ver_chain_files_d2ac03c0_6d03_01dc_f3a6_001517306488 (id, cust_id, gridfid, "sequence", txn_id, ishead, comp_type, comp_size, uncomp_size, comp_ratio, comp_percent, comp_time)
  VALUES (new.id, new.cust_id, new.gridfid, new."sequence", new.txn_id, new.ishead, new.comp_type, new.comp_size, new.uncomp_size, new.comp_ratio, new.comp_percent, new.comp_time)

The rule __00__ver_chain_files is there to force the last rule that was executed to return it's insert status. As I said above it worked fine when there was only one rule.

Any help would be appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 10:11 am 
Newbie

Joined: Mon Nov 05, 2007 12:12 pm
Posts: 5
No one has any insight into this behavior? Is there no way for hibernate to handle this kind of a situation?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.