NutzCN Logo
问答 关于@one插入顺序的问题
发布于 2830天前 作者 asdf3309 1677 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk
2017-02-22 22:55:18 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:388} - RUN 
2017-02-22 22:55:18 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:388} - select SEQ_MR_MSG.nextval from dual
2017-02-22 22:55:18 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:388} - INSERT INTO MR_MSG(msgid,msgclass,msgversion,msgtime,appname,appver,termkey,res_errcode,res_errmsg,res_errdetail) VALUES(?,?,?,?,?,?,?,?,?,?) 
    |   1 |      2 |                     3 |                   4 |              5 | 6 |               7 |    8 |    9 |   10 |
    |-----|--------|-----------------------|---------------------|----------------|---|-----------------|------|------|------|
    | 276 | CBXZ02 | 1.1.trunk.20161215apk | 2017-02-22 22:55:29 | netmrs_android | 1 | 867031025324440 | NULL | NULL | NULL |
  For example:> "INSERT INTO MR_MSG(msgid,msgclass,msgversion,msgtime,appname,appver,termkey,res_errcode,res_errmsg,res_errdetail) VALUES(276,'CBXZ02','1.1.trunk.20161215apk','2017-02-22 22:55:29','netmrs_android','1','867031025324440','NULL','NULL','NULL') "
2017-02-22 22:55:18 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:388} - RUN 
2017-02-22 22:55:18 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:388} - select SEQ_MR_MSG_XZDCMX.nextval from dual
2017-02-22 22:55:18 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:388} - INSERT INTO MR_MSG_XZDCMX(id,msgid,ygid,mm,sfyf,bcxxs,yyqyid,bkjls,xzpcid,sxbl,xxbl,zxsl,ms1,ms2,ms3,ms4,ms5) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) 
    |  1 |   2 |    3 |                  4 |                   5 |             6 |  7 |    8 |    9 |   10 |   11 |   12 |   13 |   14 |   15 |   16 |   17 |
    |----|-----|------|--------------------|---------------------|---------------|----|------|------|------|------|------|------|------|------|------|------|
    | 20 | 276 | 1591 | 6E4D43A347B15C346D | 2015-11-01 00:00:00 | 80003, 80000, | 11 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
  For example:> "INSERT INTO MR_MSG_XZDCMX(id,msgid,ygid,mm,sfyf,bcxxs,yyqyid,bkjls,xzpcid,sxbl,xxbl,zxsl,ms1,ms2,ms3,ms4,ms5) VALUES(20,276,1591,'6E4D43A347B15C346D','2015-11-01 00:00:00','80003, 80000,','11','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL') "

上面这段内容是某个相同配置表的内容,插入顺序是对的

下面这个配置相同,却没有先插入@one的对象

2017-02-22 22:58:52 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:388} - select SEQ_MR_MSG_XZBKMX.nextval from dual
2017-02-22 22:58:52 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:388} - INSERT INTO MR_MSG_XZBKMX(id,msgid,ygid,mm,xzpcid,qshh,qqhs,yyqyid,fhhs) VALUES(?,?,?,?,?,?,?,?,?) 
    |  1 |    2 |    3 |                  4 |   5 | 6 |   7 |  8 |    9 |
    |----|------|------|--------------------|-----|---|-----|----|------|
    | 16 | NULL | 1591 | 5E4D6B6DB3418B546C | 281 | 1 | 100 | 11 | NULL |
  For example:> "INSERT INTO MR_MSG_XZBKMX(id,msgid,ygid,mm,xzpcid,qshh,qqhs,yyqyid,fhhs) VALUES(16,'NULL',1591,'5E4D6B6DB3418B546C',281,1,100,'11','NULL') "
2017-02-22 22:58:52 [DEBUG] org.nutz.dao.impl.sql.run.NutDaoExecutor {NutDaoExecutor.java:97} - SQLException
java.sql.SQLException: ORA-01400: 无法将 NULL 插入 ("NETMRS_NEW"."MR_MSG_XZBKMX"."MSGID")

	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
	at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
	at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
	at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190)
	at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
	at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3476)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
	at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
	at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:131)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:308)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at com.pft.core.integration.SpringDaoRunner.run(SpringDaoRunner.java:17)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:247)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
	at org.nutz.dao.impl.NutDao.insertWith(NutDao.java:228)
	at com.pft.mobile.remote.service.RemoteService.saveXzbkmx(RemoteService.java:550)
	at com.pft.mobile.remote.web.CommonController.getCbxz03(CommonController.java:523)
	at com.pft.mobile.remote.web.CommonController.requests(CommonController.java:217)
	at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

5 回复

发现在这里是value是null

public class DoInsertLinkVisitor extends AbstractLinkVisitor {

    public void visit(final Object obj, final LinkField lnk) {
        final Object value = lnk.getValue(obj);
        if (Lang.length(value) == 0)
            return;

好的,可以关闭了,原来msg放对象了,导致木有msg,所以没执行连接插入

原来解决了。。。

我试了几遍还没试出来,正纳闷呢

不过我还是没看明白原因,再描述得详细一点点?

基本上理解了, 原因是:

insert(xxx) 的时候, xxx.msg没有值(忘记设置/了), 所以不存在关联对象的插入,只插入主对象, 所以报错.

添加回复
请先登陆
回到顶部