Hibernate自建数据库的问题 5C

clazz--->class com.lyc.oa.domain.Role
2018-04-06 15:04:12,688 ERROR [SchemaUpdate.java:212] : Unsuccessful: create table lyc_role (id longint not null, name varchar(255), description varchar(255), primary key (id))
2018-04-06 15:04:12,690 ERROR [SchemaUpdate.java:213] : 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 'longint not null, name varchar(255), description varchar(255), primary key (id))' at line 1
clazz--->class com.lyc.oa.domain.User
SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
clazz--->class com.lyc.oa.domain.Role
2018-04-06 15:04:12,967 ERROR [SchemaUpdate.java:212] : Unsuccessful: create table lyc_role (id longint not null, name varchar(255), description varchar(255), primary key (id))
2018-04-06 15:04:12,967 ERROR [SchemaUpdate.java:213] : 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 'longint not null, name varchar(255), description varchar(255), primary key (id))' at line 1
clazz--->class com.lyc.oa.domain.User
Hibernate: insert into lyc_user (name, id) values (?, ?)
Hibernate: insert into lyc_user (name, id) values (?, ?)
clazz--->class com.lyc.oa.domain.Role
2018-04-06 15:04:13,202 ERROR [SchemaUpdate.java:212] : Unsuccessful: create table lyc_role (id longint not null, name varchar(255), description varchar(255), primary key (id))
2018-04-06 15:04:13,203 ERROR [SchemaUpdate.java:213] : 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 'longint not null, name varchar(255), description varchar(255), primary key (id))' at line 1
clazz--->class com.lyc.oa.domain.User
com.lyc.oa.test.TestAction@73331054

出现这些错误,要怎么解决

6个回答

2018-04-06 15:04:12,967 ERROR [SchemaUpdate.java:212] : Unsuccessful: create table lyc_role (id longint not null, name varchar(255), description varchar(255), primary key (id))
2018-04-06 15:04:12,967 ERROR [SchemaUpdate.java:213] : 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 'longint not null, name varchar(255), description varchar(255), primary key (id))' at line 1

该怎么解决

这个要去检查你的数据库了,我看不到啊

是不是框架配置出错误了

你建表的sql语句写的有问题,错误里已经写出来了

根据报错提示,创建表格的语法有问题,检查是否使用数据库自留关键词或者执行语句定位语法错误原因。

dingjian1986
dingjian1986 回复weixin_41724818: mysql里没有longint类型,longint改为bigint(默认长度20)或者int(默认长度11)
大约 2 年之前 回复
weixin_41724818
weixin_41724818 我是使用代码用hibernate自动生成的库,都不知道为啥会提示longint有错误,我都是使用long
大约 2 年之前 回复

数据库建好之后直接用myeclipse的逆向工程生成pojo类就可以了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐