當列與數據庫列不匹配時,我們在日誌中獲取異常,如下面的行。但它並沒有拋出異常。我甚至不停地嘗試抓住。我如何捕捉異常?捕捉休眠異常SqlExceptionHelper
WARN 2015-11-04 17:25:44,055 [SqlExceptionHelper.java:144]:SQL錯誤:904,SQLState:42000 錯誤2015-11-04 17 :25:44055 [HTTP-APR-8080-EXEC-4] [SqlExceptionHelper.java:146]:ORA-00904: 「SH_RATE_DESCRIPTIO」:無效identi 費裏
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
import com.core.model.entity.ShippingTable;
@Repository("sTableDAO")
public class STableDao {
@PersistenceContext(unitName = "somaUnit")
private EntityManager entityManager;
public STable save(STable sTable) {
try{
sTable = entityManager.merge(sTable);
}catch(Exception e){
e.printStackTrace();
}
return sTable;
}
}