kbank 소스 일부 복원
This commit is contained in:
@@ -7,6 +7,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Component
|
||||
@Aspect
|
||||
@@ -16,9 +17,9 @@ public class JpaErrorLoggingAspect {
|
||||
private EntityManager em;
|
||||
|
||||
@AfterThrowing(pointcut = "@annotation(org.springframework.transaction.annotation.Transactional)", throwing = "ex")
|
||||
public void onError(Exception ex) {
|
||||
public void onError(SQLException ex) {
|
||||
try {
|
||||
String user = (String) em.createNativeQuery("select user from user").getSingleResult();
|
||||
String user = (String) em.createNativeQuery("select user from dual").getSingleResult();
|
||||
log.error("DB USER = {}, SQL ERROR = {}", user, ex.getMessage() );
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to fetch DB User", e);
|
||||
|
||||
Reference in New Issue
Block a user