关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 34436|回复: 16

[Online开发] 主从表单的主表单后台数据库触发器错误无法抛出

[复制链接]
发表于 2018-8-19 22:59:05 | 显示全部楼层 |阅读模式
主从设置的主表单中数据库触发器的触发的错误只是在后台控制台显示,不抛出给用户,就是提示操作成功,其实是已经发生错误了,原来3.7.2是可以抛出的

[2018-08-19 22:54:00] [ERROR] [org.hibernate.engine.jdbc.spi.SqlExceptionHelper:
144] 日期错误,结束入住时间2018-08-19 22:54:00不应该小于开始入住时间2018-10-18 0
0:00:00
org.hibernate.exception.GenericJDBCException: 日期错误,结束入住时间2018-08-19 2
2:54:00不应该小于开始入住时间2018-10-18 00:00:00
        at org.hibernate.exception.internal.StandardSQLExceptionConverter.conver
t(StandardSQLExceptionConverter.java:54)
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlException
Helper.java:125)
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlException
Helper.java:110)
        at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandle
r.continueInvocation(AbstractStatementProxyHandler.java:129)
        at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(
AbstractProxyHandler.java:81)
        at $Proxy151.executeUpdate(Unknown Source)
        at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(Jd
bcTemplate.java:916)
        at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(Jd
bcTemplate.java:909)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:
644)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:9
09)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:9
33)
        at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.u
pdate(NamedParameterJdbcTemplate.java:313)
        at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.u
pdate(NamedParameterJdbcTemplate.java:318)
        at org.jeecgframework.web.cgform.service.impl.build.DataBaseServiceImpl.
executeSqlExtend(DataBaseServiceImpl.java:326)
        at sun.reflect.GeneratedMethodAccessor780.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:157)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.
proceedWithInvocation(TransactionInterceptor.java:98)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.
invokeWithinTransaction(TransactionAspectSupport.java:262)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:95)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:207)
        at $Proxy113.executeSqlExtend(Unknown Source)
        at org.jeecgframework.web.cgform.controller.build.CgFormBuildController.
doButton(CgFormBuildController.java:695)
        at sun.reflect.GeneratedMethodAccessor781.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvok
e(InvocableHandlerMethod.java:221)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeF
orRequest(InvocableHandlerMethod.java:137)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocabl
eHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingH
andlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingH
andlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapt
er.handle(AbstractHandlerMethodAdapter.java:85)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch
erServlet.java:938)
        at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche
rServlet.java:870)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(Frame
workServlet.java:961)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServ
let.java:863)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkSer
vlet.java:837)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:165)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52
)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:165)
        at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.j
ava:123)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:165)
        at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:114)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:165)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
al(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:165)
        at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.do
FilterInternal(OpenSessionInViewFilter.java:150)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:165)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:96)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:474)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:140)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:79)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAcce
ssLogValve.java:624)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:87)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:349)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java
:783)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLig
ht.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Abstract
Protocol.java:789)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
int.java:1437)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBas
e.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
read.java:61)
        at java.lang.Thread.run(Thread.java:722)
Caused by: java.sql.SQLException: 日期错误,结束入住时间2018-08-19 22:54:00不应
该小于开始入住时间2018-10-18 00:00:00
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja
va:2156)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:2459)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:2376)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:2360)
        at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpd
ate(FilterChainImpl.java:2843)
        at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdat
e(FilterAdapter.java:1091)
        at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute
Update(FilterEventAdapter.java:491)
        at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpd
ate(FilterChainImpl.java:2841)
        at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeUpdate
(PreparedStatementProxyImpl.java:194)
        at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(Dru
idPooledPreparedStatement.java:256)
        at sun.reflect.GeneratedMethodAccessor368.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandle
r.continueInvocation(AbstractStatementProxyHandler.java:122)
        ... 75 more
[2018-08-19 22:54:00] [INFO] [org.jeecgframework.web.cgform.controller.build.CgF

发表于 2018-8-20 11:24:37 | 显示全部楼层
那个版本?
 楼主| 发表于 2018-8-20 12:11:52 | 显示全部楼层
admin 发表于 2018-8-20 11:24
那个版本?

3.7.8,原来的3.7.2版本主从可以抛出,单表不能不能抛出,现在3.7.8版本两者都不行
发表于 2018-8-20 13:44:53 | 显示全部楼层
请说明,具体重现步骤,尽量详细
 楼主| 发表于 2018-8-20 17:42:31 | 显示全部楼层
admin 发表于 2018-8-20 13:44
请说明,具体重现步骤,尽量详细

在online开发中自定义按钮增加了一个SQL增强,点击按钮时触发SQL语句操作,对该SQL的操作涉及到的表中存在update触发器,触发器中判别结束日期小于开始日期时,触发器抛出异常,数据库级抛出异常后,框架应接收到异常,然后返回异常信息给操作用户,告诉用户出错了,但是现在异常抛出来了,操作用户看到的确实操作成功的提示,数据没有改变,在服务器的控制台上可以看到发生了异常,只是该异常没有抛出来
发表于 2018-8-21 10:52:36 | 显示全部楼层
收录
发表于 2018-8-27 11:14:41 | 显示全部楼层
请把抛出异常的语句贴出来
 楼主| 发表于 2018-8-27 20:02:13 | 显示全部楼层
jeecg_ty 发表于 2018-8-27 11:14
请把抛出异常的语句贴出来

set msg =concat("日期错误,结束入住时间",ifnull(new.roomuseend,current_timestamp),"不应该小于开始入住时间",new.roomusestart);  
SIGNAL SQLSTATE 'HY000' SET MESSAGE_TEXT = msg;


与触发器无关的,触发器是正常抛出了,控制台可以看到错误,但是估计是js中没有把错误进行分析判断
发表于 2018-8-28 15:13:38 | 显示全部楼层
  
QZN9J{AG_}L7Z2XV6PDPW$B.png
K@K4R0HZ5``7N~~I`RKH{BI.png
_M}6LROCD]T07(}XJK0DG(6.png
 楼主| 发表于 2018-8-28 16:41:15 | 显示全部楼层
jeecg_ty 发表于 2018-8-28 15:13

后台是抛了错误出来,但是呈现给操作用户的还是操作成功的信息,而不是:日期错误,结束入住时间2018-08-19 22:54:00不应该小于开始入住时间2018-10-18 00:00:00,正确的应该是这个错误信息吧!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表