-->
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: Couldn't solve the problem, anyone help me! SQL update or...
PostPosted: Fri Mar 05, 2004 5:00 am 
Newbie

Joined: Mon Feb 16, 2004 3:03 am
Posts: 7
I have a small program, which try to update an informix database based on given parameters. First I delete the original records from db, then insert the new one. The problem occurs, and I searched the forum and tried all of the solutions it mentions, but my problem still there, which is:

Could not synchronize database state with session
net.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.delete(EntityPersister.java:582)
at net.sf.hibernate.impl.ScheduledDeletion.execute(ScheduledDeletion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2266)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1738)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1499)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1464)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1454)
at MsgReciver.saveObj(MsgReciver.java:252)
at MsgReciver.readObject(MsgReciver.java:126)
at MsgReciver.main(MsgReciver.java:40)

My code is simple:
Code:
session.delete(query, new Object[] { pk1, pk2 }, new Type[] {Hibernate.STRING, Hibernate.STRING });
            
            session.flush();
            session.save(obj);


and all of my mapping files are like this one:
Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class
        name="other"
        table="t_other"
        dynamic-update="false"
        dynamic-insert="false"
    >

        <id
            name="p_no"
            column="p_no"
            type="string"
            unsaved-value="null"
        >
            <generator class="assigned">
            </generator>
        </id>

        <property
            name="act_pre"
            type="double"
            update="true"
            insert="true"
            column="act_pre"
        />

        <property
            name="adjratio"
            type="double"
            update="true"
            insert="true"
            column="adjratio"
        />

        <property
            name="ayear_pre"
            type="double"
            update="true"
            insert="true"
            column="ayear_pre"
        />

        <property
            name="bas_pre"
            type="double"
            update="true"
            insert="true"
            column="bas_pre"
        />

        <property
            name="beadj"
            type="double"
            update="true"
            insert="true"
            column="beadj"
        />

        <property
            name="canprm"
            type="char"
            update="true"
            insert="true"
            column="canprm"
        />

        <property
            name="chxcsh"
            type="short"
            update="true"
            insert="true"
            column="chxcsh"
        />

        <property
            name="edrno"
            type="string"
            update="true"
            insert="true"
            column="edrno"
        />

        <property
            name="fgs"
            type="string"
            update="true"
            insert="true"
            column="fgs"
        />

        <property
            name="fl"
            type="double"
            update="true"
            insert="true"
            column="fl"
        />

        <property
            name="ispar"
            type="short"
            update="true"
            insert="true"
            column="ispar"
        />

        <property
            name="last_t_date"
            type="date"
            update="true"
            insert="true"
            column="last_t_date"
        />

        <property
            name="last_u_date"
            type="date"
            update="true"
            insert="true"
            column="last_u_date"
        />

        <property
            name="max_xe"
            type="double"
            update="true"
            insert="true"
            column="max_xe"
        />

        <property
            name="mp"
            type="double"
            update="true"
            insert="true"
            column="mp"
        />

        <property
            name="oldzxdm"
            type="string"
            update="true"
            insert="true"
            column="oldzxdm"
        />

        <property
            name="otherprm"
            type="double"
            update="true"
            insert="true"
            column="otherprm"
        />

        <property
            name="pchje"
            type="double"
            update="true"
            insert="true"
            column="pchje"
        />

        <property
            name="plc_no"
            type="string"
            update="true"
            insert="true"
            column="plc_no"
        />

        <property
            name="pre_rate"
            type="double"
            update="true"
            insert="true"
            column="pre_rate"
        />

        <property
            name="rz"
            type="short"
            update="true"
            insert="true"
            column="rz"
        />

        <property
            name="safeprm"
            type="double"
            update="true"
            insert="true"
            column="safeprm"
        />

        <property
            name="safeyear"
            type="short"
            update="true"
            insert="true"
            column="safeyear"
        />

        <property
            name="senum"
            type="short"
            update="true"
            insert="true"
            column="senum"
        />

        <property
            name="vageadj"
            type="double"
            update="true"
            insert="true"
            column="vageadj"
        />

        <property
            name="vehno"
            type="short"
            update="true"
            insert="true"
            column="vehno"
        />

        <property
            name="xzhdm"
            type="string"
            update="true"
            insert="true"
            column="xzhdm"
        />

        <property
            name="year_pre"
            type="double"
            update="true"
            insert="true"
            column="year_pre"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-other.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


Please help me! [/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 5:47 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You're not showing the right stacktrace comparing to your code.

_________________
Emmanuel


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.