-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: batch: insert, update or delete failed
PostPosted: Wed Mar 23, 2005 4:29 pm 
Newbie

Joined: Wed Mar 23, 2005 4:29 am
Posts: 7
I have a bidirectional relationship like this.
Code:
    <class name="A" table="a">
    <id name="ID"  type="int" unsaved-value="null">
        <column name="ID" sql-type="int" not-null="true"/>
        <generator class="native"/>
    </id>
...   
<bag name="bitems" table="b" cascade="all">
         <key column="bref"/>
         <one-to-many class="B"/>
      </bag>
    </class>


and

Code:
<class name="B" table="b">
    <id name="ID" type="int" unsaved-value="null">
        <column name="ID" sql-type="int" not-null="true"/>
        <generator class="native"/>
    </id>
       
    <many-to-one name="aitem" class="A" column="bref"/>


When I try to insert something I get the following errors:
Code:
net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row no
t found)
        at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatche
r.java:25)
        at net.sf.hibernate.collection.AbstractCollectionPersister.recreate(Abst
ractCollectionPersister.java:526)
        at net.sf.hibernate.impl.ScheduledCollectionRecreate.execute(ScheduledCo
llectionRecreate.java:23)
        at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
        at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
        at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2396)
        at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
        at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.j
ava:61)
...


I think it has something to do with the fact that the relationship is bidirectional but I'm not sure. Can anyone help? Setting inverse="true" in the bag tag doesn't help


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 27, 2005 5:01 am 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
You should set show-sql to true (or use p6spy) and see the generated SQL, that should give you a hint if this is a DB error... maybe this is a foreign key or constraint error, try disabling the constraints to see if that is it (though the SQL will show this too). Chris


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.