|
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>
|