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.  [ 1 post ] 
Author Message
 Post subject: Hibernate issues DELETE and INSERT statemets independently
PostPosted: Wed Jul 27, 2005 9:43 am 
Beginner
Beginner

Joined: Tue May 10, 2005 4:18 am
Posts: 29
My code is completly used for quering of data, without any "save" or "update" calls.
However- I have 1 mapping that generates delete and insert statements which I can spot in the log file.
Why is it ?

I can see from the delete/insert statments that it is related with my special "set" mappings.
I.E. this set mapping :
<set name="connectedPersons" table="tRel" lazy="true" where="idevnt Is Not Null AND idpers Is Not Null" cascade="none">
<key column="idevnt"/>
<composite-element class="InfoObjectRelatedPerson">
<many-to-one name="relationType" column="reltyp" class="RelationType" insert="false" update="false"/>
<many-to-one name="targetPerson" column="idpers" class="Person" insert="false" update="false"/>
</composite-element>
</set>

will produce the SQL :
delete from tRel where idevnt=? and reltyp=? and idpers=?
insert into tRel (idevnt, reltyp, idpers) values (?, ?, ?)

And I do not know why this SQL is generated.
Can you please help ?

Thank you !

Elad

P.S. - this is the full mapping file, in case it is needed :

The mapping is :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="de.emld.wlan.business">
<class name="InfoObject" table="tkevnt" mutable="false" lazy="true">
<cache usage="read-only"/>
<id name="id" type="long" column="idevnt">
<generator class="sequence">
<param name="sequence">tkevnt_s</param>
</generator>
</id>
<property name="localeTitle" column="title" type="string"/>
<property name="localeDescription" column="description" type="string"/>
<component name="beginDate" class="FuzzyDate">
<property name="day" column="begind" not-null="false"/>
<property name="month" column="beginm" not-null="false"/>
<property name="year" column="beginy" not-null="false"/>
</component>
<component name="endDate" class="FuzzyDate">
<property name="day" column="endd" not-null="false"/>
<property name="month" column="endm" not-null="false"/>
<property name="year" column="endy" not-null="false"/>
</component>
<many-to-one name="mainImage" class="Image" column="main_image"/>
<set name="connectedPersons" table="tRel" lazy="true" where="idevnt Is Not Null AND idpers Is Not Null" cascade="none">
<key column="idevnt"/>
<composite-element class="InfoObjectRelatedPerson">
<many-to-one name="relationType" column="reltyp" class="RelationType" insert="false" update="false"/>
<many-to-one name="targetPerson" column="idpers" class="Person" insert="false" update="false"/>
</composite-element>
</set>
<set name="connectedImages" table="tRel" lazy="true" where="idevnt Is Not Null AND idbild Is Not Null" cascade="none">
<key column="idevnt"/>
<composite-element class="InfoObjectRelatedImage">
<many-to-one name="relationType" column="reltyp" class="RelationType" insert="false" update="false"/>
<many-to-one name="targetImage" column="idbild" class="Image" insert="false" update="false"/>
</composite-element>
</set>
<set name="connectedInfoObjects" table="trevntevnt" lazy="true" cascade="none">
<key column="idevnt1"/>
<composite-element class="InfoObjectRelatedInfoObject">
<many-to-one name="relationType" column="firelfn" class="RelationType" insert="false" update="false"/>
<many-to-one name="targetInfoObject" column="idevnt2" class="InfoObject" insert="false" update="false"/>
</composite-element>
</set>
</class>
</hibernate-mapping>


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

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.