NutzCN Logo
问答 在springboot中使用nutzdao 自动生成表问题
发布于 2510天前 作者 qq_2df9dd31 3044 次浏览 复制 上一个帖子 下一个帖子
标签:

springboot项目中使用nutz的dao 配置是这样


nutz: json: enabled: false mode: compact date-format: yyyyMMdd HH:mm:ss dao: runtime: add-column: true check-index: true delete-column: true foce-create: false create: true migration: true basepackage: "com.twin.sakura" sqlmanager: paths: - sqls

简单测试的bo是这样子的,(使用了lombok 有无出现都出现异常)

@Table("hello_tt")
public @Data class hello_sakura {

    @Column
    private String id;

    @Column
    private String kname;

}

异常信息, 表能正常创建 就是会报这个异常

2018-02-12 16:36:17.679 DEBUG 10544 --- [           main] .n.p.s.b.FileSqlManagerAutoConfiguration : spring-resource-->hello_sakura.class
2018-02-12 16:36:17.823 DEBUG 10544 --- [           main] org.nutz.dao.util.Daos                   : migration Table 'hello_tt' fail!

org.postgresql.util.PSQLException: 错误: 语法错误 在 "from" 或附近的
  位置:12
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270) ~[postgresql-9.4-1201-jdbc41.jar:9.4]
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998) ~[postgresql-9.4-1201-jdbc41.jar:9.4]
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) ~[postgresql-9.4-1201-jdbc41.jar:9.4]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570) ~[postgresql-9.4-1201-jdbc41.jar:9.4]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420) ~[postgresql-9.4-1201-jdbc41.jar:9.4]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:305) ~[postgresql-9.4-1201-jdbc41.jar:9.4]
	at org.nutz.dao.impl.jdbc.AbstractJdbcExpert.getIndexNames(AbstractJdbcExpert.java:481) ~[nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.util.Daos$3.invoke(Daos.java:741) ~[nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:125) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.util.Daos.migration(Daos.java:698) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.util.Daos.migration(Daos.java:911) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.plugin.spring.boot.listener.NutzDataBaseIniter$2.invoke(NutzDataBaseIniter.java:48) [nutz-plugins-spring-boot-starter-1.r.62.jar:na]
	at org.nutz.plugin.spring.boot.listener.NutzDataBaseIniter$2.invoke(NutzDataBaseIniter.java:44) [nutz-plugins-spring-boot-starter-1.r.62.jar:na]
	at org.nutz.lang.Lang.each(Lang.java:1585) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.lang.Lang.each(Lang.java:1550) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.plugin.spring.boot.listener.NutzDataBaseIniter.create(NutzDataBaseIniter.java:44) [nutz-plugins-spring-boot-starter-1.r.62.jar:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:311) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:134) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) [spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at com.guojxx.sakura.SmallSakuraBlogApplication.main(SmallSakuraBlogApplication.java:10) [classes/:na]


5 回复

设置 关闭自动变更 又正常 这是为啥啊

 migration: false

1.r.65? 还是出现那个问题啊

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