当前位置:编程学习 > JAVA >>

使用Hibernate注解自动生成表的时候老是报错,各位大哥大姐帮帮忙解决下。谢谢了

hibernate.cfg.xml配置如下:
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<!--<mapping resource="com/yhj/hibernate/model/Student.hbm.xml" />-->
<mapping class="com.pb.hibernate.model.Group"/>
<mapping class="com.pb.hibernate.model.User"/>
报错信息如下:
20:36:30,373  INFO SchemaExport:226 - Running hbm2ddl schema export
20:36:30,376 DEBUG SchemaExport:242 - import file not found: /import.sql
20:36:30,376  INFO SchemaExport:251 - exporting generated schema to database
20:36:30,562 DEBUG SchemaExport:377 - alter table t_user drop constraint FKCB63CCB6737A136A
20:36:30,569 DEBUG SchemaExport:362 - Unsuccessful: alter table t_user drop constraint FKCB63CCB6737A136A
20:36:30,570 DEBUG SchemaExport:363 - ORA-00942: 表或视图不存在

20:36:30,571 DEBUG SchemaExport:377 - drop table t_group if exists
20:36:30,572 DEBUG SchemaExport:362 - Unsuccessful: drop table t_group if exists
20:36:30,572 DEBUG SchemaExport:363 - ORA-00933: SQL 命令未正确结束

20:36:30,572 DEBUG SchemaExport:377 - drop table t_user if exists
20:36:30,573 DEBUG SchemaExport:362 - Unsuccessful: drop table t_user if exists
20:36:30,574 DEBUG SchemaExport:363 - ORA-00933: SQL 命令未正确结束

20:36:30,574 DEBUG SchemaExport:377 - create table t_group (id integer generated by default as identity (start with 1), name varchar(255), primary key (id))
20:36:30,575 ERROR SchemaExport:348 - Unsuccessful: create table t_group (id integer generated by default as identity (start with 1), name varchar(255), primary key (id))
20:36:30,576 ERROR SchemaExport:349 - ORA-00907: 缺失右括号

20:36:30,576 DEBUG SchemaExport:377 - create table t_user (id integer generated by default as identity (start with 1), name varchar(255), group_id integer, primary key (id))
20:36:30,577 ERROR SchemaExport:348 - Unsuccessful: create table t_user (id integer generated by default as identity (start with 1), name varchar(255), group_id integer, primary key (id))
20:36:30,577 ERROR SchemaExport:349 - ORA-00907: 缺失右括号

20:36:30,577 DEBUG SchemaExport:377 - alter table t_user add constraint FKCB63CCB6737A136A foreign key (group_id) references t_group
20:36:30,579 ERROR SchemaExport:348 - Unsuccessful: alter table t_user add constraint FKCB63CCB6737A136A foreign key (group_id) references t_group
20:36:30,580 ERROR SchemaExport:349 - ORA-00942: 表或视图不存在

20:36:30,580  INFO SchemaExport:268 - schema export complete
--------------------编程问答-------------------- 同样的问题,求解
补充:Java ,  Java相关
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,