Hi,
vielleicht kann mir jemand einen Tip geben:
Wenn ich versuche eine Objekt zu laden (unter Verwendung des unten gezeigten Mappings), werden nach den entsprechenden SELECTs eine DELETE auf die Tabelle XYZ und danach wieder eine INSERT auf diese ausgeführt, was zu einer unique index violation des Indexes (ID, T_ID, M_ID, S_ID) = IX_XYZ) (zu Recht) führt.
Weiß jemand, warum DELETE und INSERT auf childs ausgeführt werden bzw. wo man dazu etwas nachlesen kann (Reference Guide/Hibernate in Action:Kapitel? - oder noch besser, was ist zu tun, um das Problem zu lösen.
Vielen Dank im Voraus.
Gruß
Puenthi
Hibernate version:2.x
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="model">
<class name="Parent" table="PARENT">
<id column="ID" name="id" type="java.lang.Long" >
<generator class="sequence">
<param name="sequence">SEQ_PARENT</param>
</generator>
</id>
<property name="bezeichnung" column="BEZEICHNUNG" type="java.lang.String" not-null="true"/>
<set name="child" table="XYZ" lazy="false" inverse="false" cascade="none" >
<key>
<column name="ID" />
</key>
<composite-element class="model. Model" >
<many-to-one column="T_ID" name="type" class="model.Type" not-null="true"/>
<many-to-one column="M_ID" name="model" class="model.Model" not-null="true"/>
<many-to-one column="S_ID" name="type2" class="model.Type2" not-null="false"/>
</composite-element>
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
getHibernateTemplate.load(Parent.class, Long id);
Full stack trace of any exception that occurs:
org.springframework.dao.DataIntegrityViolationException: Hibernate transaction synchronization: could not insert collection rows: [model.parent.childs#1]; SQL []; ORA-00001: Verstoß gegen Eindeutigkeit, Regel (IX_XYZ)
; nested exception is java.sql.SQLException: ORA-00001: Verstoß gegen Eindeutigkeit, Regel (IX_XYZ)
java.sql.SQLException: ORA-00001: Verstoß gegen Eindeutigkeit, Regel (MBWEB.IX_SVPS)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1094)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2132)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2015)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2877)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.collection.AbstractCollectionPersister.insertRows(AbstractCollectionPersister.java:610)
at net.sf.hibernate.impl.ScheduledCollectionUpdate.execute(ScheduledCollectionUpdate.java:49)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2394)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2260)
at org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCommit(SessionFactoryUtils.java:825)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:661)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:486)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:473)
at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:267)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
Name and version of the database you are using:
Oracle 9.x
|