-->
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: Trigger problem genereta row effect 0, how to disable check
PostPosted: Wed Aug 19, 2009 6:09 am 
Newbie

Joined: Wed Aug 19, 2009 6:04 am
Posts: 2
I have a legacy database, and i cant change this particular Trigger on the DB.

When i update a Entity, the trigger answers with 2 returns
Code:
(0 row(s) affected) 
 
(1 row(s) affected)


Hibernate is just catching the first return (the one with "0 rows affected"), and then throws a exception. I want to disable this hibernate check, how can i do that ?
Obs.: Change the trigger is not a option, i cant change the database

My resume stack trace:
Code:
Hibernate:   
    update 
        Pessoaf   
    set 
        ClassificacaoPessoa=?, 
        DataNasc=?, 
        CodGrauEscol=?, 
        CodPais=?, 
        Sexo=?   
    where 
        CodParceiro=? 
javax.persistence.RollbackException: Error while commiting the transaction 
    at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71) 
    at br.com.integrativa.logic.UsuarioLogic.persistir(UsuarioLogic.java:226) 
        .... 
Caused by: javax.persistence.OptimisticLockException 
    at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:650) 
    at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:59) 
    ... 37 more 
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [br.com.integrativa.persistence.model.parceiro.PessoaFisica#2040513] 
    at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765) 
    at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2407) 


Top
 Profile  
 
 Post subject: Re: Trigger problem genereta row effect 0, how to disable check
PostPosted: Wed Aug 19, 2009 1:16 pm 
Regular
Regular

Joined: Mon Jan 05, 2009 6:42 pm
Posts: 99
Location: IL
Ok Not sure if this helps..
How come the trigger comes back with two results when there is only one update going on?
Is this an option- to disable the trigger and re-enable the trigger after your hibernate transaction is finished? Assuming disable would not harm the database integrity.
-Srilatha.


Top
 Profile  
 
 Post subject: Re: Trigger problem genereta row affect 0, how to disable check
PostPosted: Wed Aug 19, 2009 3:23 pm 
Newbie

Joined: Wed Aug 19, 2009 6:04 am
Posts: 2
SQLServer2000 ...

that is it, 2 msgs of row affected, and i cant turn off triggers, i need to disable that on Hibernate, not on database...

hiberante is checking if this row was updated and that is my problem, cause SQLServer 2000 send 2 msgs,

I try do that with SQL Intruction on the databse and its fine, and realy i got back 2 msgs of row affected, but with Hibernate i got that problem.

The fact is on trigger others instructions exists and that intructions send row affected too =/


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.