Hibernate根据注解自动建表,有的表新建出错是什么原因

项目是自己的毕业设计,当时是没什么问题,但是时过几个月,现在重新运行,发现有两张表始终无法新建,
那好吧,我自己手动建,但是此时我的hbm2ddl.auto=update,当启动tomcat,update到这张表的时候,tomcat直接卡在这里,然后就提示超时了,不知道是什么原因

Hibernate相关属性配置

 dataSource.driverClassName=oracle.jdbc.driver.OracleDriver
dataSource.url=jdbc:oracle:thin:@localhost:1521:orcl
dataSource.username=c##graduate
dataSource.password=graduate
dataSource.dialect=org.hibernate.dialect.Oracle10gDialect
dataSource.hbm2ddl.auto=create
dataSource.show_sql=true
dataSource.show_format=true
dataSoure.connection.release_mode=after_statement
dataSoure.packagesToScan=com.cdu.entity

不能新建的两张表的实体类信息

 @Entity
@Table(name = "CONTACTS_INFO")
public class ContactsPo {
    @Id
    @GenericGenerator(name = "idGenerator", strategy = "uuid")
    @GeneratedValue(generator = "idGenerator")
    @Column(name = "ID")
    // ID
    private String id;

    // 用户ID,用于与用户表进行关联,但并不设置外键
    @Column(name = "U_ID", nullable = false)
    private String u_id;

    // 文档的真实名字
    @Column(name = "NAME", nullable = false)
    private String name;

        }

        @Entity
@Table(name = "USERS_INFO")
public class UsersPo {
    @Id
    @GenericGenerator(name = "idGenerator", strategy = "uuid")
    @GeneratedValue(generator = "idGenerator")
    @Column(name = "U_ID")
    private String u_id;

    // 用户名
    @Column(name = "USERNAME", nullable = false)
    private String username;

    // 密码
    @Column(name = "PASSWORD", nullable = false)
    private String password;
        }

启动tomcat错误代码

 ERROR,[2015-10-14 21:42:43,643],ORA-00936: 缺失表达式
,org.hibernate.tool.hbm2ddl.SchemaExport.perform(SchemaExport.java:427)
Hibernate: create table VIDEOS (ID varchar2(255 char) not null, ALIAS varchar2(40 char) not null, CREATETIME varchar2(255 char), ISDELETE INT default 0, ISRECYCLE INT default 0, MAGNITUDE number(19,0), PATH varchar2(255 char), REALNAME varchar2(100 char) not null, U_ID varchar2(255 char) not null, primary key (ID))
Hibernate: create table c##graduate.CONTACTS_INFO (ID varchar2(255 char) not null, ADDRESS varchar2(255 char), CREATETIME varchar2(255 char), EMAIL varchar2(255 char), HOME varchar2(255 char), ISDELETE INT default 0, ISRECYCLE INT default 0, NAME varchar2(255 char) not null, PHONE varchar2(255 char) not null, PROFILE varchar2(100) default userHead/default.jpg, SCHOOL varchar2(255 char), U_ID varchar2(255 char) not null, primary key (ID))
ERROR,[2015-10-14 21:42:43,667],HHH000389: Unsuccessful: create table c##graduate.CONTACTS_INFO (ID varchar2(255 char) not null, ADDRESS varchar2(255 char), CREATETIME varchar2(255 char), EMAIL varchar2(255 char), HOME varchar2(255 char), ISDELETE INT default 0, ISRECYCLE INT default 0, NAME varchar2(255 char) not null, PHONE varchar2(255 char) not null, PROFILE varchar2(100) default userHead/default.jpg, SCHOOL varchar2(255 char), U_ID varchar2(255 char) not null, primary key (ID)),org.hibernate.tool.hbm2ddl.SchemaExport.perform(SchemaExport.java:426)
ERROR,[2015-10-14 21:42:43,668],ORA-00936: 缺失表达式
,org.hibernate.tool.hbm2ddl.SchemaExport.perform(SchemaExport.java:427)
INFO,[2015-10-14 21:42:43,671],HHH000230: Schema export complete,org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:406)

1个回答

我想是你的参数的问题吧,不是number类型的参数需要格式,比如 user_id是varchar2的,那么你给的参数里应该加单引号,'user_id',日期类型的也需要to_date来转换的吧。只是一个可能,你测试一下.

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