Hibernate 映射文件报错!

这是我配置的映射文件

<class name="entity.Backmoney" table="backmoney">
 <id name="code" type="java.lang.String">
  <column name="code" />
  <generator class="assigned" />
 </id>

----------------------------------------------------------------------------

我数据库这个表里面的主键是Varchar2类型的! 我想自定义设置主键!

运行的时候出错了!

Exception in thread "main" org.hibernate.MappingException: Repeated column in mapping for entity: entity.Backmoney_detail column: code (should be mapped with insert="false" update="false")
 at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:652)
 at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:674)
 at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:696)
 at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:450)
 at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
 at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
 at Test.Test.test1(Test.java:46)
 at Test.Test.main(Test.java:17)

 这个问题怎么解决 大家帮忙看看~

[code="java"]


seq_backmoney
START WITH 1

[/code]

这样试试

试试。

" entity.Backmoney_detail column: code (should be mapped with insert="false" update="false") ",所以在class配置中加上insert="false" update="false" :
[code="xml"]





[/code]