Hibernate version: 3.2CR2, Hibernate Annotations 3.2CR1 (and Spring as well)
Hi all
i have a problem while loading an object. These are my mapping files /annotated classes (the important parts):
Aktion.java
Code:
@Entity
@Table(name = "TAKTION")
public class Aktion implements java.io.Serializable {
// Fields
private Set<TransaktionAktionMapping> transaktionsMapping = new HashSet<TransaktionAktionMapping>(
0);
//more FIELDS
/**
* @return
*/
@OneToMany(cascade = { CascadeType.REMOVE }, fetch = FetchType.EAGER, mappedBy = "aktion")
@Cascade( { org.hibernate.annotations.CascadeType.DELETE })
public Set<TransaktionAktionMapping> getTransaktionsMapping() {
return this.transaktionsMapping;
}
/**
* @param transaktionsMapping
*/
public void setTransaktionsMapping(Set<TransaktionAktionMapping> transaktionsMapping) {
this.transaktionsMapping = transaktionsMapping;
}
//MORE METHODS
}
Transaktion.java
/
Code:
**
* Transaktion generated by hbm2java
*/
@Entity
@Table(name = "TTRANSAKTION")
public class Transaktion implements java.io.Serializable {
private Set<TransaktionAktionMapping> aktionsMapping = new HashSet<TransaktionAktionMapping>(0);
//MORE FIELDS
/**
* @return aktionsMapping
*/
@OneToMany(cascade = { CascadeType.REMOVE}, fetch = FetchType.LAZY, mappedBy = "transaktion")
@Cascade( { org.hibernate.annotations.CascadeType.DELETE })
public Set<TransaktionAktionMapping> getAktionsMapping() {
return this.aktionsMapping;
}
/**
* @param aktionsMapping
*/
public void setAktionsMapping(Set<TransaktionAktionMapping> aktionsMapping) {
this.aktionsMapping = aktionsMapping;
}
//MORE METHODS
}
TransaktionAktion.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 06.06.2006 09:50:36 by Hibernate Tools 3.1.0.beta5 for NDBJS Re7 -->
<hibernate-mapping>
<class name="najsre7.model.TransaktionAktionMapping" table="TTRANSAKTION_AKTION" >
<composite-id>
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<key-many-to-one name="transaktion" class="najsre7.model.Transaktion" column="FK_TTRANSAKTION_ILAUFNR" />
<key-many-to-one name="aktion" class="najsre7.model.Aktion" column="FK_TAKTION_ILAUFNR" />
</composite-id>
<timestamp name="mutDatum" column="DMUTDAT" />
<property name="mutUser" type="java.lang.String">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<column name="SMUTUSER" length="10" not-null="true" />
</property>
<property name="stvUser" type="java.lang.String">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<column name="SSTVUSER" length="10" />
</property>
<many-to-one name="transaktion" class="najsre7.model.Transaktion" column="FK_TTRANSAKTION_ILAUFNR" lazy="false" fetch="join" insert="false" update="false"/>
<many-to-one name="aktion" class="najsre7.model.Aktion" column="FK_TAKTION_ILAUFNR" lazy="false" fetch="join" insert="false" update="false"/>
</class>
</hibernate-mapping>
So i'm loading an Aktion object now, then i change the assigned TransaktionAktionMapping collection (adding or removing object) and afterwads i try to load the object again by calling the Manager Method:
Code:
Aktion aktion = securityManager.getAktion(aktionId);
But as I can see hibernate doesn't execute a SELECT statement, so my object with the new assigned collection isn't loaded.
Does somebody have an idea about this problem?
Kind Regards
Angela