NutzCN Logo
问答 用pojo创建数据库表出错
发布于 2444天前 作者 bb3239 1471 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group VARCHAR(30) COMMENT '组',
name VARCHAR(30) COMMENT '名称',
p F' at line 4
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

写了一个pojo,在创建数据库表的时候老抱着个错误,不理解,下面是pojo类

@Column
    @Comment("组")
    @ColDefine(type = ColType.VARCHAR, width = 30)
    private String group="默认组";

    @Column
    @Comment("名称")
    @ColDefine(type = ColType.VARCHAR, width = 30)
    private String name="名称";

    @Column
    @Comment("p")
    @ColDefine(type = ColType.FLOAT)
    private float p=0;
3 回复

name,是关键字哦.最好不要用

@qq_32b899df nutzwk的很多系统表的pojo字段也用的是name

@qq_32b899df 搞定了,是group关键字冲突了

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