Hi. I am trying to load data from the file to oracle DB. When I use sesion.save(..) insert is successful, when I use session saveOrUpdate(..) I am getting error - org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.metlife.tmw.db.InstncLkup#123]. InstncLkup is just  a POJO object
Here is my code:
Code:
String tableName = prepareReflectionObject((String)SessionManagement.getSessionScope("displayTableName"));
   Class<?> cls;
   try {
      session.beginTransaction();
      String classPath = "com.metlife.tmw.db." + tableName;
      cls = Class.forName(classPath);
         
         
      if(fileExt.equals("xls") || fileExt.equals("xlsx")){
         for(int i = 0; i< rows.size(); i++){
         Row row = (Row)rows.get(i);
         Object instance = cls.newInstance();
         for(int j = 0; j < alImportColumnInfo.size(); j++){
                      ColumnInfo ci = (ColumnInfo)alImportColumnInfo.get(j);
            String methodName = "set" + prepareReflectionObject(ci.getColumnName());
            if(ci.getDataType().equals("NUMBER")){
               method = ((Class<?>) instance).getDeclaredMethod (methodName, Double.class);
               method.invoke(instance, row.getCell(j).getNumericCellValue());
            }
            else if(ci.getDataType().equals("DATE")){
               Date colDate = importValidator.xlsCellToDate(row, j);
               method = ((Class<?>) instance).getDeclaredMethod (methodName, Date.class);
               method.invoke(instance, colDate);
            }
            else{
               if(row.getCell(j).getCellType() == Cell.CELL_TYPE_NUMERIC){
                  colValue = importValidator.xlsCellToString(row, j);
               }
               else{
                  colValue = row.getCell(j).getStringCellValue();
               }
               method = instance.getClass().getMethod(methodName, String.class);
               method.invoke(instance, colValue);
               
            }
         }
         method = instance.getClass().getMethod("setCreateTs", java.sql.Date.class);
         method.invoke(instance, new java.sql.Date(System.currentTimeMillis()));
                  
         method = instance.getClass().getMethod("setLstUpdtTs", java.sql.Date.class);
         method.invoke(instance, new java.sql.Date(System.currentTimeMillis()));
                  
         method = instance.getClass().getMethod("setLstUpdtUsr", String.class);
         method.invoke(instance, "bla");
         session.saveOrUpdate(instance);
      }
                }
      else{
               
      }
      session.getTransaction().commit();
      session.flush();
   } catch (Exception e) {
            logger.error("File Upload - loadValidRows");
            logger.error(e.getStackTrace());
            System.out.println(printStack(e));
            return "Problem importing the file";
         } 
 Here is xml file
<class name="com.metlife.tmw.db.InstncLkup" table="INSTNC_LKUP" schema="TFRMW" select-before-update="true">
		<id name = "instncCd" column = "INSTNC_CD" type="java.lang.String">
			<generator class="assigned"></generator>
		</id>
		<property name="instncDesc"	column="INSTNC_DESC"/>
		<property name="ftpSrvrNm"	column="FTP_SRVR_NM"/>
		<property name="ftpUsrIdTxt" column="FTP_USR_ID_TXT"/>
		<property name="ftpPwTxt"	column="FTP_PW_TXT"/>
		<property name="ftpRmotDirTxt"	column="FTP_RMOT_DIR_TXT"/>
		<property name="activeInd"	column="ACTIVE_IND"/>
		<property name="createTs"	column="CREATE_TS" />
		<property name="lstUpdtTs"	column="LST_UPDT_TS"/>
		<property name="lstUpdtUsr"	column="LST_UPDT_USR"/>
	</class>
Here is stacktrace:
 Hibernate: select instnclkup_.INSTNC_CD, instnclkup_.INSTNC_DESC as INSTNC2_0_, instnclkup_.FTP_SRVR_NM as FTP3_0_, instnclkup_.FTP_USR_ID_TXT as FTP4_0_, instnclkup_.FTP_PW_TXT as FTP5_0_, instnclkup_.FTP_RMOT_DIR_TXT as FTP6_0_, instnclkup_.ACTIVE_IND as ACTIVE7_0_, instnclkup_.CREATE_TS as CREATE8_0_, instnclkup_.LST_UPDT_TS as LST9_0_, instnclkup_.LST_UPDT_USR as LST10_0_ from TFRMW.INSTNC_LKUP instnclkup_ where instnclkup_.INSTNC_CD=?
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.metlife.tmw.db.InstncLkup#123]
	at org.hibernate.event.def.DefaultFlushEntityEventListener.getDatabaseSnapshot(DefaultFlushEntityEventListener.java:592)
	at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:545)
	at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:230)
	at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:154)
	at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
	at com.metlife.tmw.backingbeans.FileUpload.loadValidRows(FileUpload.java:307)
	at com.metlife.tmw.backingbeans.FileUpload.uploadFile(FileUpload.java:212)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.apache.el.parser.AstValue.invoke(AstValue.java:159)
	at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
	at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
	at javax.faces.component.UICommand.broadcast(UICommand.java:387)
	at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
	at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
	at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
	at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
	at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
	at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
	at com.metlife.tmw.common.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:63)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
	at com.metlife.tmw.common.SessionLogoffFilter.doFilter(SessionLogoffFilter.java:67)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
	at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
	at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
	at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
	at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
	at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Any suggestions? 
Thank you