hibernate配置问题。请教高手~~~

wangxiaolin88528852 2012-02-18 11:50:06
我的domain里面是这么写的

<union-subclass name="Topic" table=" wisdom_topic">
<property name="type" column="type_" />
<many-to-one name="forum" column="forumId_" lazy="false" />
<property name="summary" column="summary_" length="500" />

<property name="viewCount" column="viewCount_" />
<property name="replyCount" column="replyCount_" />
<!-- 这是一对一的关系,但把unique设为了false。
因为在sqlserver中运行时,有异常如下:
违反了 UNIQUE KEY 约束 'UQ__wisdom_topic__1367E606'。不能在对象 'dbo.wisdom_topic' 中插入重复键。 -->
<many-to-one name="lastReply" column="lastReplyId_" unique="false" lazy="false" />

<property name="lastArticlePostTime" column="lastArticlePostTime_" />
<property name="nextFloor" column="nextFloor_" />
</union-subclass>

始终报错如下:

23:35:25,125 [main] ERROR SchemaUpdate : Unsuccessful: create table wisdom_topic (id_ varchar(255) not null, title_ varchar(255), content_ text, authorId_ varchar(45), postTime_ datetime, ipAddr_ varchar(16), deleted_ bit, type_ varchar(255), forumId_ varchar(255), summary_ text, viewCount_ integer, replyCount_ integer, lastReplyId_ varchar(255), lastArticlePostTime_ datetime, nextFloor_ integer, primary key (id_)) ==> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:155)
23:35:25,125 [main] ERROR SchemaUpdate : Table 'wisdom_topic' already exists ==> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:156)
23:35:25,125 [main] ERROR SchemaUpdate : Unsuccessful: alter table wisdom_topic add index FK56D80D5190BF431F (forumId_), add constraint FK56D80D5190BF431F foreign key (forumId_) references wisdom_forum (id_) ==> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:155)
23:35:25,125 [main] ERROR SchemaUpdate : Duplicate key name 'FK56D80D5190BF431F' ==> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:156)
23:35:25,125 [main] ERROR SchemaUpdate : Unsuccessful: alter table wisdom_topic add index FK56D80D51F0AA1F15 (lastReplyId_), add constraint FK56D80D51F0AA1F15 foreign key (lastReplyId_) references wisdom_reply (id_) ==> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:155)
23:35:25,125 [main] ERROR SchemaUpdate : Duplicate key name 'FK56D80D51F0AA1F15' ==> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:156)
23:35:25,140 [main] ERROR SchemaUpdate : Unsuccessful: alter table wisdom_topic add index FKDDDD4478AE4DB58956d80d51 (authorId_), add constraint FKDDDD4478AE4DB58956d80d51 foreign key (authorId_) references wisdom_user (id_) ==> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:155)
23:35:25,140 [main] ERROR SchemaUpdate : Duplicate key name 'FKDDDD4478AE4DB58956d80d51' ==> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:156)


是个什么原因呢??不懂。。。。每次看见控制台报错,头就很大。。。。。学的不扎实。。还请各位赐教啊,,,,
...全文
195 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
断天 2012-02-21
  • 打赏
  • 举报
回复
Table 'wisdom_topic' already exists
提示表wisdom_topic已经存在了
qq737604771 2012-02-19
  • 打赏
  • 举报
回复
好像是表关联的事情。 是不是那里建了外键。

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧