浏览 6556 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2004-03-12
引用 Hibernate: insert into WD_Equipment (EquipName, EquipType, EquipId) values (?, ?, ?)
update WD_Slot set SlotName=?, SlotType=?, EquipId=?, IfUse=? where SlotId=? Equipment 与 Slot 是父子关系 Equipment.hbm.xml
Slot.hbm.xml <class name="com.zhongying.atm.common.Slot" table="WD_Slot"> <id name="slotId" type="long" column="SlotId" unsaved-value="none"> <generator class="hilo"/></id> <property name="slotName" type="string" column="SlotName"/> <property name="slotType" type="string" column="SlotType"/> <many-to-one name="equipment" column="EquipId" not-null="true"/> <property name="ifUse" type="boolean" column="IfUse"/> </class> 存储代码 Equipment equip = new Equipment();; equip.setEquipName("shhaibeijing");; equip.setEquipType("type");; List array = new ArrayList();; equip.setSlots(array);; Slot slot = new Slot();; slot.setSlotName("sh-slot1");; slot.setSlotType("ss");; equip.addSlot(slot);; session.save(equip);; session.flush();; 以下是出错log 引用 et.sf.hibernate.HibernateException: SQL update or deletion failed (row not found)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:25) at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:642) at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:611) at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:31) at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2100) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2062) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2005) at com.zhongying.atm.db.DbAccess.main(DbAccess.java:203) 7471 [main] DEBUG net.sf.hibernate.transaction.JDBCTransaction - rollback 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2004-03-13
试试把inverse=false看看!
|
|
返回顶楼 |