ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vinaya Tirikkovalluru" <vinaya.tirikkovall...@converge.com>
Subject RE: Transaction Rollback not working with iBatis + Spring
Date Wed, 21 Jul 2010 18:07:51 GMT
Does just the insert work on the table which is giving the issue without
the insert into the history?
 


-----Original Message-----
From: Bruno Issenmann [mailto:b.issenmann@labsoft.fr] 
Sent: Wednesday, July 21, 2010 2:03 PM
To: user-java@ibatis.apache.org
Subject: Re: Transaction Rollback not working with iBatis + Spring

Vinaya Tirikkovalluru <vinaya.tirikkovalluru <at> converge.com> writes:

> 
> Sorry!! I missed the thread.
> Does it give you a runtime exception? Only if the code throws a
runtime
> exception the transaction will be rolled back
> 
> Vinaya

I have a runtime exception, transaction is rolled back. When i run the
SQL
manually on oracle it's ok.
But with the dao i got a constraint integrity violation. It's like the
inserts
go in the wrong order (complains about the first table id missing).
Or i'm wrong with the dao.

Here is my code

public class LotTest extends DAOManagerTest {

    @Test
    public void testInsert(){
    	
    	DAOFactory.daoMgr.startTransaction();
    	try {
        	LotDAO dao =
(LotDAO)DAOFactory.daoMgr.getDao(LotDAO.class);
        	Lot lot = new Lot();
        	lot.setIdlot("201000000008");
        	//lot.setNumhistolot(new Short("1"));
        	lot.setIdlotamm("20char");
        	dao.insert(lot);
        	
        	HistoLotDAO dao2 =
(HistoLotDAO)DAOFactory.daoMgr.getDao(HistoLotDAO.class);
        	HistoLot histo = new HistoLot();
        	histo.setIdlot("201000000008");
        	histo.setNumhistolot(new Short("1"));
        	histo.setIdetatlot("EC");
        	histo.setDateetatlot(new Date());
        	histo.setInfoetatlot("20char");
        	dao2.insert(histo);
        	
        	DAOFactory.daoMgr.commitTransaction();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            DAOFactory.daoMgr.endTransaction();
        }
    }
}

Thanks,
Bruno


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org



This electronic message is intended only for the use of the individual(s) or entity(ies) named
above and may contain information which is privileged and/or confidential.  If you are not
the intended recipient, be aware that any disclosure, copying, distribution, dissemination
or use of the contents of this message is prohibited.  If you received this message in error,
please notify the sender immediately.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message