1,5 → 1,6 |
package pt.estgp.estgweb.web; |
|
import org.hibernate.exception.ConstraintViolationException; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.web.utils.RequestUtils; |
8,7 → 9,6 |
|
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import java.sql.BatchUpdateException; |
|
/** |
* @author Jorge Machado |
61,19 → 61,20 |
} |
catch (Throwable e) |
{ |
if(e instanceof BatchUpdateException) |
if(e instanceof ConstraintViolationException) |
{ |
if(e.getCause() != null && e.getCause().toString() != null && e.getCause().toString().indexOf("Duplicate Entry")>=0) |
{ |
// if(e.getCause() != null && e.getCause().toString() != null && e.getCause().toString().indexOf("Duplicate Entry")>=0) |
// { |
System.out.println(Thread.currentThread().getId() + " - Duplicada foi guardada noutra thread: " +RequestUtils.getRequester(request, response) ); |
IServiceManager sm = ServiceManager.getInstance(); |
Object[] args = new Object[]{RequestUtils.getRequester(request, response)}; |
UserSession userSession = (UserSession) sm.execute(RequestUtils.getRequester(request, response),"LoadUserSession",args); |
request.setAttribute(Globals.USER_SESSION_KEY,userSession); |
return userSession; |
} |
// } |
} |
throw e; |
else |
throw e; |
} |
} |
|