google-code-export / nutz

Automatically exported from code.google.com/p/nutz
Apache License 2.0
1 stars 1 forks source link

使用dao进行数据插入,Chain条件报错 #528

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
问题产生的条件:
this.dao().insert(
    User.class,Chain.make("username", user.getUsername()).add("password", user.getPassword()));
使用上述代码会出现空指针异常,但是如果换做sql的话,就��
�会出现任何问题
this.dao().execute(
    Sqls.create("insert into cs_user(cs_user_name, cs_user_passwd) values ('"+ user.getUsername()+ "', '"+ user.getPassword() + "')"));这样就不会出现任何问题

发生问题的调用代码:

问题的详细说明:

异常堆栈:
log4j: 2011-10-12 21:16:15,140 [http-8000-3] ERROR 
org.nutz.mvc.impl.processor.FailProcessor - Catch handle error
java.lang.NullPointerException
    at org.nutz.dao.impl.sql.pojo.InsertByChainPItem.joinAdaptor(InsertByChainPItem.java:46)
    at org.nutz.dao.impl.jdbc.NutPojo.getAdaptors(NutPojo.java:63)
    at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:156)
    at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:139)
    at org.nutz.dao.impl.DaoSupport$2.invoke(DaoSupport.java:181)
    at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:63)
    at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:178)
    at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
    at org.nutz.dao.impl.NutDao.insert(NutDao.java:118)
    at com.cs.dao.UserDao.addUser(UserDao.java:70)
    at com.cs.action.UserAction.addUser(UserAction.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:22)
    at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
    at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
    at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
    at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:42)
    at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
    at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:76)
    at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
    at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
    at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
    at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
    at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:36)
    at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:66)
    at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:30)
    at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:60)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:818)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
    at java.lang.Thread.run(Unknown Source)

相关日志:
log4j: 2011-10-12 21:16:15,140 [http-8000-3] ERROR 
org.nutz.mvc.impl.processor.FailProcessor - Catch handle error

Original issue reported on code.google.com by wak...@gmail.com on 12 Oct 2011 at 1:37

GoogleCodeExporter commented 9 years ago
已经修正

Original comment by wendal1985@gmail.com on 21 Oct 2011 at 3:27