NutzCN Logo
精华 模型中怎么处理PSQL_ARRAY字段,自己设置出错
发布于 3165天前 作者 汉歌 2268 次浏览 复制 上一个帖子 下一个帖子
标签:

定义一个Array 数字字段出错

    @ColDefine(type = ColType.PSQL_ARRAY)//, width = 673)//,adaptor=IntegerJsonValueAdaptor.class
    private Integer[]  negativeKeywords;//NegativeKeywords

出现以下错误```
2016-03-24 10:20:58,107 [ERROR][org.nutz.mvc.impl.NutLoading] - Error happend during start serivce!
org.nutz.dao.DaoException: !Nutz SQL Error: 'CREATE TABLE system_plan(
id SERIAL,
name VARCHAR(50),
account_id NUMERIC(16),
dailyBudget NUMERIC(6,2),
mobileBidrate NUMERIC(3,2) NOT NULL,
status BOOLEAN,
creativeMode NUMERIC(8),
dynamicCreativeState ARRAY,
extendedPeriod ARRAY,
promotionArea ARRAY,
negativeKeywords ARRAY,
CONSTRAINT system_plan_pkey PRIMARY KEY (id)
)'
PreparedStatement:
'CREATE TABLE system_plan(
id SERIAL,
name VARCHAR(50),
account_id NUMERIC(16),
dailyBudget NUMERIC(6,2),
mobileBidrate NUMERIC(3,2) NOT NULL,
status BOOLEAN,
creativeMode NUMERIC(8),
dynamicCreativeState ARRAY,
extendedPeriod ARRAY,
promotionArea ARRAY,
negativeKeywords ARRAY,
CONSTRAINT system_plan_pkey PRIMARY KEY (id)
)'
CaseMessage=����: ������ �� "ARRAY" �򸽽���
λ�ã�205
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:96)
at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:159)
at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:316)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:38)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
at org.nutz.dao.impl.DaoSupport$DaoExec.run(DaoSupport.java:306)
at org.nutz.trans.Trans.exec(Trans.java:174)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:276)
at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:235)
at org.nutz.dao.impl.NutDao.execute(NutDao.java:983)
at org.nutz.dao.impl.jdbc.psql.PsqlJdbcExpert.createEntity(PsqlJdbcExpert.java:100)
at org.nutz.dao.impl.EntityHolder.reloadEntity(EntityHolder.java:85)
at org.nutz.dao.impl.NutDao.create(NutDao.java:784)
at org.nutz.dao.util.Daos.createTablesInPackage(Daos.java:537)
at com.rekoe.MvcSetup.init(MvcSetup.java:42)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
at org.nutz.mvc.ActionHandler.(ActionHandler.java:19)
at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:454)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:396)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.postgresql.util.PSQLException: ����: ������ �� "ARRAY" �򸽽���
λ�ã�205
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:622)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:458)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:450)
at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:421)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:321)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:52)
... 62 more

```

17 回复

存list 吧 然后用那个json适配器就可以了

    @Column("pay_by_quarter")
    @ColDefine(customType = "integer[]", type = ColType.PSQL_ARRAY)
    private Integer[] payByQuarter;

    @Column("schedule")
    @ColDefine(customType = "varchar[]", type = ColType.PSQL_ARRAY)
    private String[] schedule;

Starting scanner at interval of 10 seconds.
2016-03-24 10:42:21,974 [WARN][org.nutz.mvc.impl.processor.FailProcessor] - Error@/admin/plan/list :
org.nutz.dao.DaoException: java.lang.RuntimeException: Fail to set '{1}'[ null ] by setter com.rekoe.domain.Plan.'setDynamicCreativeState()' because [org.nutz.lang.born.BorningException: Fail to born '[Ljava.lang.Integer;'
by args: [
@({1})]]: Fail to born '[Ljava.lang.Integer;'
by args: [
@({1})]
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:49)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
at org.nutz.dao.impl.DaoSupport$DaoExec.run(DaoSupport.java:306)
at org.nutz.trans.Trans.exec(Trans.java:174)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:276)
at org.nutz.dao.impl.NutDao.query(NutDao.java:465)
at com.rekoe.service.PlanService.getPlanListByPager(PlanService.java:60)
at com.rekoe.module.admin.PlanAct.list(PlanAct.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
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:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:51)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
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:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.RuntimeException: Fail to set '{1}'[ null ] by setter com.rekoe.domain.Plan.'setDynamicCreativeState()' because [org.nutz.lang.born.BorningException: Fail to born '[Ljava.lang.Integer;'

完了数字类型怎么输出?

注意,需要给 POJO 添加带一个参数的静态工厂方法或者带一个参数的构造函数,
显示的使用 java.sql.ResultSet 来创建该 POJO,不然会出现无法映射的错误。

public class Pet {

    public static Pet getInstance(ResultSet rs) throws SQLException {
        Pet pet = new Pet();
        pet.setId(rs.getInt("id"));
        pet.setPayByQuarter((Integer[]) rs.getArray("pay_by_quarter").getArray());
        return pet;
    }

    @Column("pay_by_quarter")
    @ColDefine(customType = "integer[]", type = ColType.PSQL_ARRAY)
    private Integer[] payByQuarter;

    // ... 省略后面代码,包括字段声明以及 getter 和 setter
}

public class Jone {

    public static Jone(ResultSet rs) throws SQLException {
        this.id = rs.getInt("id");
        this.schedule = (String[]) rs.getArray("schedule").getArray();
    }

    @ColDefine(customType = "varchar[]", type = ColType.PSQL_ARRAY)
    private String[] schedule;

    // ... 省略后面代码,包括字段声明以及 getter 和 setter
}

@qq_8136064a
个人感觉还是用属性适配器处理更完整一些

0.02016-03-24 13:24:13,664 [WARN][org.nutz.mvc.impl.processor.FailProcessor] - Error@/admin/plan/update :
org.nutz.dao.DaoException: java.lang.ClassCastException: java.lang.Float cannot be cast to [Ljava.lang.Integer;
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:49)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
	at org.nutz.dao.impl.DaoSupport$DaoExec.run(DaoSupport.java:306)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:276)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
	at org.nutz.dao.impl.NutDao.update(NutDao.java:279)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.nutz.dao.util.ExtDaoInvocationHandler$1.run(Daos.java:1048)
	at org.nutz.dao.FieldFilter.run(FieldFilter.java:286)
	at org.nutz.dao.FieldFilter.run(FieldFilter.java:297)
	at org.nutz.dao.util.ExtDaoInvocationHandler.invoke(Daos.java:1070)
	at com.sun.proxy.$Proxy126.update(Unknown Source)
	at com.rekoe.service.PlanService.update(PlanService.java:46)
	at com.rekoe.module.admin.PlanAct.update(PlanAct.java:93)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:51)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.ClassCastException: java.lang.Float cannot be cast to [Ljava.lang.Integer;
	at com.rekoe.adaptor.impl.Array1ValueAdaptor.set(Array1ValueAdaptor.java:30)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:266)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:82)
	at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:159)
	at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:316)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:38)
	... 63 more

读取已经可以,但写入出现错误

来自 PsqlArrayTest.java

```java
StudentArray student = new StudentArray();
Integer[] payByQuarter = {1000, 1300, 1500, 1200};
String[] schedule = new String[]{"02", "05", "08", "11"};
student.setPayByQuarter(payByQuarter);
student.setSchedule(schedule);

    int insertId = dao.insert(student).getId();
    StudentArray insertStudent = dao.fetch(StudentArray.class, insertId);
    assertTrue(Lang.equals(payByQuarter, insertStudent.getPayByQuarter()));
    assertTrue(Lang.equals(schedule, insertStudent.getSchedule()));

    payByQuarter[2] = 2500;
    schedule[2] = "09";
    insertStudent.setPayByQuarter(payByQuarter);
    insertStudent.setSchedule(schedule);
    dao.updateIgnoreNull(insertStudent);
    StudentArray updateStudent = dao.fetch(StudentArray.class, insertId);
    assertEquals(Integer.valueOf(2500), updateStudent.getPayByQuarter()[2]);
    assertEquals("09", updateStudent.getSchedule()[2]);

```

老问题,数组转换失败

org.nutz.dao.DaoException: java.lang.RuntimeException: Fail to set '{1}'[ null ] by setter com.rekoe.domain.Plan.'setDynamicCreativeState()' because [org.nutz.lang.born.BorningException: Fail to born '[Ljava.lang.Integer;'
 by args: [
  @({1})]]: Fail to born '[Ljava.lang.Integer;'
 by args: [
  @({1})]
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:49)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
	at org.nutz.dao.impl.DaoSupport$DaoExec.run(DaoSupport.java:306)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:276)
	at org.nutz.dao.impl.NutDao.fetch(NutDao.java:565)
	at org.nutz.service.EntityService.fetch(EntityService.java:157)
	at com.rekoe.module.admin.PlanAct.update(PlanAct.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:51)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.RuntimeException: Fail to set '{1}'[ null ] by setter com.rekoe.domain.Plan.'setDynamicCreativeState()' because [org.nutz.lang.born.BorningException: Fail to born '[Ljava.lang.Integer;'
 by args: [
  @({1})]]: Fail to born '[Ljava.lang.Integer;'
 by args: [
  @({1})]
	at org.nutz.lang.Lang.makeThrow(Lang.java:102)
	at org.nutz.lang.inject.InjectBySetter.inject(InjectBySetter.java:44)
	at org.nutz.dao.impl.entity.field.AbstractEntityField.setValue(AbstractEntityField.java:53)
	at org.nutz.dao.impl.entity.field.NutMappingField.injectValue(NutMappingField.java:85)
	at org.nutz.dao.impl.entity.NutEntity.getObject(NutEntity.java:232)
	at org.nutz.dao.impl.sql.pojo.PojoFetchEntityCallback.invoke(PojoFetchEntityCallback.java:21)
	at org.nutz.dao.impl.jdbc.NutPojo.onAfter(NutPojo.java:109)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:233)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:45)
	at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:316)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:38)
	... 53 more

不加适配器的话,查询列表出错,加了适配器,保存出错
不加适配器的话,连查询列表都出错,加了适配器,查询列表没问题,但保存还出错
代码

    @ColDefine(customType="integer[]", type = ColType.PSQL_ARRAY,adaptor=ArrAdaptor.class)
    private Integer[] promotionArea;
    

适配器

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rekoe.adaptor.impl;
import java.sql.Array;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import org.nutz.castor.Castors;
import org.nutz.dao.jdbc.ValueAdaptor;
import org.nutz.json.Json;
public  class ArrAdaptor implements ValueAdaptor {
	@Override
	public  Object get(ResultSet rs, String colName) throws SQLException{
	    
	    Object obj = rs.getArray(colName).getArray();
	    Integer[] iArr = Castors.me().castTo(obj, Integer[].class);
	    return iArr;
	}

	@Override
	public void set(PreparedStatement stat, Object obj, int index) throws SQLException {
	    if (null == obj) {
		stat.setNull(index, Types.NULL);
	    } else {
		//System.out.println ( Json.toJson ( obj) );
		//System.out.println ( obj.getClass ());
		stat.getConnection().createArrayOf("integer[]", (Integer[]) obj);
	    }
	}
}

加了适配器后的代码,查询列表没问题,但保存还出错

2016-03-25 08:56:55,941 [WARN][org.nutz.mvc.impl.processor.FailProcessor] - Error@/admin/plan/update :
org.nutz.dao.DaoException: !Nutz SQL Error: 'UPDATE system_plan SET name=?,account_id=?,dailyBudget=?,mobileBidrate=?,status=?,creativeMode=?,dynamicCreativeState=?,extendedPeriod=?,promotionArea=?,negativeKeywords=?  WHERE id=?
    |   1 | 2 |   3 |   4 |    5 | 6 |   7 |   8 |   9 |         10 | 11 |
    |-----|---|-----|-----|------|---|-----|-----|-----|------------|---|
    | xxx | 1 | 1.0 | 1.0 | true | 1 | [1] | [1] | [1] | [1, 2, 32] | 3 |
  For example:> "UPDATE system_plan SET name='xxx',account_id=1,dailyBudget=1.0,mobileBidrate=1.0,status=true,creativeMode=1,dynamicCreativeState='[1]',extendedPeriod='[1]',promotionArea='[1]',negativeKeywords='[1, 2, 32]'  WHERE id=3"'
PreparedStatement: 
'UPDATE system_plan SET name=?,account_id=?,dailyBudget=?,mobileBidrate=?,status=?,creativeMode=?,dynamicCreativeState=?,extendedPeriod=?,promotionArea=?,negativeKeywords=?  WHERE id=?'
CaseMessage=Unable to find server array type for provided name integer[].
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:96)
	at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:316)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:38)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
	at org.nutz.dao.impl.DaoSupport$DaoExec.run(DaoSupport.java:306)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:276)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
	at org.nutz.dao.impl.NutDao.update(NutDao.java:279)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.nutz.dao.util.ExtDaoInvocationHandler$1.run(Daos.java:1048)
	at org.nutz.dao.FieldFilter.run(FieldFilter.java:286)
	at org.nutz.dao.FieldFilter.run(FieldFilter.java:297)
	at org.nutz.dao.util.ExtDaoInvocationHandler.invoke(Daos.java:1070)
	at com.sun.proxy.$Proxy53.update(Unknown Source)
	at com.rekoe.service.PlanService.update(PlanService.java:46)
	at com.rekoe.module.admin.PlanAct.update(PlanAct.java:93)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:51)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.postgresql.util.PSQLException: Unable to find server array type for provided name integer[].
	at org.postgresql.jdbc.PgConnection.createArrayOf(PgConnection.java:1311)
	at com.alibaba.druid.pool.DruidPooledConnection.createArrayOf(DruidPooledConnection.java:1050)
	at com.rekoe.adaptor.impl.ArrAdaptor.set(ArrAdaptor.java:31)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:266)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:82)
	... 65 more

@wendal ```
Started Jetty Server
Starting scanner at interval of 10 seconds.
2016-03-25 09:22:19,845 [WARN][org.nutz.mvc.impl.processor.FailProcessor] - Error@/admin/plan/update :
org.nutz.dao.DaoException: !Nutz SQL Error: 'UPDATE system_plan SET name=?,account_id=?,dailyBudget=?,mobileBidrate=?,status=?,creativeMode=?,dynamicCreativeState=?,extendedPeriod=?,promotionArea=?,negativeKeywords=? WHERE id=?
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|-----|---|-----|-----|------|---|-----|-----|-----|-----------|---|
| xxx | 1 | 1.0 | 1.0 | true | 1 | [1] | [1] | [1] | [1, 2, 3] | 3 |
For example:> "UPDATE system_plan SET name='xxx',account_id=1,dailyBudget=1.0,mobileBidrate=1.0,status=true,creativeMode=1,dynamicCreativeState='[1]',extendedPeriod='[1]',promotionArea='[1]',negativeKeywords='[1, 2, 3]' WHERE id=3"'
PreparedStatement:
'UPDATE system_plan SET name=?,account_id=?,dailyBudget=?,mobileBidrate=?,status=?,creativeMode=?,dynamicCreativeState=?,extendedPeriod=?,promotionArea=?,negativeKeywords=? WHERE id=?'
CaseMessage=δ�趨����ֵ 7 �����ݡ�
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:96)
at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:316)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:38)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
at org.nutz.dao.impl.DaoSupport$DaoExec.run(DaoSupport.java:306)
at org.nutz.trans.Trans.exec(Trans.java:174)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:276)
at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
at org.nutz.dao.impl.NutDao.update(NutDao.java:279)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.nutz.dao.util.ExtDaoInvocationHandler$1.run(Daos.java:1048)
at org.nutz.dao.FieldFilter.run(FieldFilter.java:286)
at org.nutz.dao.FieldFilter.run(FieldFilter.java:297)
at org.nutz.dao.util.ExtDaoInvocationHandler.invoke(Daos.java:1070)
at com.sun.proxy.$Proxy53.update(Unknown Source)
at com.rekoe.service.PlanService.update(PlanService.java:46)
at com.rekoe.module.admin.PlanAct.update(PlanAct.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
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:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:51)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
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:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.postgresql.util.PSQLException: δ�趨����ֵ 7 �����ݡ�
at org.postgresql.core.v3.SimpleParameterList.checkAllParametersSet(SimpleParameterList.java:225)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:190)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:161)
at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:155)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:268)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:82)
... 65 more

```

	@Override
	public void set(PreparedStatement stat, Object obj, int index) throws SQLException {
	    if (null == obj) {
		stat.setNull(index, Types.NULL);
	    } else {
		Array array = stat.getConnection().createArrayOf("int", (Integer[]) obj);
                stat.setArray(index, array); // 还得当成参数设置进去.
	    }
	}

一下代码来自 PsqlArrayAdaptor.java
我觉得在ColDefine里面不需要自己写 adaptor

    public void set(PreparedStatement stat, Object obj, int index) throws SQLException {
        if (null == obj) {
            stat.setNull(index, Types.NULL);
        } else {
            String typeName = customDbType.substring(0, customDbType.length() - 2);
            Array array = stat.getConnection().createArrayOf(typeName, (Object[]) obj);
            stat.setObject(index, array, Types.ARRAY);
        }
    }

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