ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuvraj Shinde" <Yuvraj.Shi...@sos.sungard.com>
Subject RE: Autocommit not properly handled in Ibatis.
Date Fri, 19 Jan 2007 11:12:37 GMT
Hi Daniele,

  We don't have any method in session for rollback.

Regards
 yuvrajs

-----Original Message-----
From: Daniele Cremonini [mailto:daniele.cremonini@tiscali.it] 
Sent: Friday, January 19, 2007 3:43 PM
To: user-java@ibatis.apache.org
Subject: Re: Autocommit not properly handled in Ibatis.

You should put a rollback instruction in the catch section.

Daniele

Yuvraj Shinde wrote:
>
> 	public void saveAllRecords( String id, List recordList )
> 	{
> 		try
> 		{
> 		getSession().startTransaction();
> 			if (!recordList.isEmpty())
> 			{
> 				for (int i = 0; i < recordList.size();
> i++)
>
> 				{
>   	                     BasicDTO basicDTO = (BasicDTO)
> recordList.get(i);
> 				   getSession().insert(id +"_INSERT",
> basicDTO);
> 				}
> 				
> 			}
>  		getSession().commitTransaction();
> 			
> 		}
> 		catch (SQLException e)
> 		{
> 			throw new RuntimeException("Error while
> Excecuting Batch" 				+ e);
> 		}
> 		finally
> 		{
> 			try
> 			{
> 			   getSession().endTransaction();
> 			}
> 			catch (SQLException e)
> 			{
> 				throw new RuntimeException("Error while
> Excecuting 				Batch" + e);
> 				
> 			}
> 		}
> 		
> 	}
>
>   



Mime
View raw message