hibernate配置文件中重复定义导致的错误:should be mapped with insert="false" update="false"
来源:互联网 发布:知乎dota2 lol 编辑:程序博客网 时间:2024/06/12 07:58
看似配置好的配置文件,在运行的时候出现错误如下:
org.hibernate.MappingException: Repeated column in mapping for entity: july.domain.DItem column: order_id (should be mapped with insert="false" update="false");
刚开始摸不着头脑,在网上找了一通答案,终于搞定:
原来,在建立对象之间的关系的时候定义了外键,又在属性中重复设置了。代码如下:
因此只要将
org.hibernate.MappingException: Repeated column in mapping for entity: july.domain.DItem column: order_id (should be mapped with insert="false" update="false");
刚开始摸不着头脑,在网上找了一通答案,终于搞定:
原来,在建立对象之间的关系的时候定义了外键,又在属性中重复设置了。代码如下:
- <many-to-one name="order" class="DOrder" column="order_id" >
- </many-to-one>
- <property name="orderId" type="java.lang.Integer">
- <column name="order_id" not-null="true" />
- </property>
<many-to-one name="order" class="DOrder" column="order_id" > </many-to-one> <property name="orderId" type="java.lang.Integer"> <column name="order_id" not-null="true" /> </property>
因此只要将
- <property name="orderId" type="java.lang.Integer">
- <column name="order_id" not-null="true" />
<property name="orderId" type="java.lang.Integer"><column name="order_id" not-null="true" />
去掉就可以了。
另外,在定义组件关联的时候切记不要即在组件中定义属性,又在本对象映射文件里定义。否则会也会出现类似以上的异常。
- hibernate配置文件中重复定义导致的错误:should be mapped with insert="false" update="false"
- Hibernate中should be mapped with insert="false" update="false"错误
- Hibernate BeanCreationException 异常错误(should be mapped with insert="false" update="false")
- hibernate column should be mapped with insert="false" update="false" 错误原因
- should be mapped with insert="false" update="false"
- should be mapped with insert="false" update="false"
- should be mapped with insert="false" update="false"
- should be mapped with insert="false" update="false
- (should be mapped with insert="false" update="false")
- should be mapped with insert="false" update="false"
- should be mapped with insert="false" update="false"
- hibernate映射文件出现should be mapped with insert="false" update="false"
- hibernate异常-should be mapped with insert="false" update="false"
- hibernate 出现should be mapped with insert="false" update="false"
- JPA-hibernate注解之 should be mapped with insert="false" update="false"
- HIbernate报should be mapped with insert="false" update="false“错
- hibernate映射文件出现should be mapped with insert="false" update="false"
- 出现should be mapped with insert="false" update="false"的解决方法
- 远程主机强迫关闭了一个现有的连接。
- 并查集
- 编译C++与Fortran
- UVa197 - Cube(TLE)
- BSS段,数据段,代码段,堆内存和栈
- hibernate配置文件中重复定义导致的错误:should be mapped with insert="false" update="false"
- 其实,你不快乐的根源,是因为你不知道要什么!
- socket 通信 Windos 和 Linux之间 Big endian 和 little endian的转换策略
- 【转】托管代码和非托管代码的区别
- 1人30天44587行代码,分享舍得网开发经验(修订版)
- 给某汉化联盟讲些历史故事
- treeview
- No Place to Hide a Dark Heart
- 设置HOST-ONLY工作模式实现VIRTUALBOX寄主机与虚拟机互访