首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

MappingException:Repeated column in 地图ping for entity

2012-09-21 
MappingException:Repeated column in mapping for entity使用Hibernate做DB映射,出现MappingException,Ca

MappingException:Repeated column in mapping for entity
使用Hibernate做DB映射,出现MappingException,
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.fangjia.dc.model.db.Template column: RELATE_ID (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:675)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:697)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:719)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:473)
at org.hibernate.mapping.RootClass.validate(RootClass.java:235)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1332)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1835)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 61 more

检查代码:

@Id@Column(name = "ID")@GeneratedValue(strategy = GenerationType.AUTO)private int id;@ManyToOne@JoinColumn(name = "RELATE_ID", nullable = false)private WebSite webSite;public WebSite getWebSite() {return webSite;}

囧啊,教训,让你乱写,让你乱写!

热点排行