Hallo,
ich habe eine Tabelle, die in vielen anderen Tabellen referenziert wird (Siehe Mapping document).
Wenn ich folgende Methode find (siehe Unten) Aufrufe, werden nicht nur Daten von der Tabelle Blsversion und Blsstr abgeholt, sondern ebenfalls von anderen Referenzen. Ich habe ebenfalls bei Mapping-Datei anstatt bei Referenzen inverse="true", lazy="true" benützt, aber immer wieder ohne Erfolg.
Kann mir vielleicht jemand sagen, wa ich falsch mache und wie ich nur Daten in den Speicher hole, den ich momentan wirklich benötige?
mfg,
Jerinic Stasa
Code:
public List find(int nBlsversionid, String sbls, String st) {
List list = null;
Session ses = blsstrDAO.createNewSession();
try {
Transaction tx = ses.beginTransaction();
try {
Query q= ses.createQuery("from Blsversion b right outer join b.blsstrSet s where ((s.sbls like :sbls) and (s.st like :st) and (b.blsversionid= :blsversionid))");
q.setInteger("blsversionid", nBlsversionid);
q.setString("sbls", Utilities.makeLike(sbls));
q.setString("st", Utilities.makeLike(st));
list = q.list();
tx.commit();
} catch (HibernateException e) {
tx.rollback();
String msg = ERROR_MSG + e.getMessage();
logger.error(msg, e);
} catch (InfrastructureException e) {
String msg = ERROR_MSG + e.getMessage();
logger.error(msg, e);
} catch (Exception e) {
String msg = ERROR_MSG + e.getMessage();
logger.error(msg, e);
}
} finally {
blsstrDAO.closeSession(ses);
}
return list;
}
Hibernate version: 3.1
Mapping documents:<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping package="at.dato.hibernate.stammdaten">
<class name="Blsversion" table="BLSVERSION">
<id name="blsversionid" type="java.lang.Integer" column="BLSVERSIONID">
<generator class="identity" />
</id>
<version name="version" column="VERSION" type="java.lang.Integer"/>
<property name="bezeichnung" column="BEZEICHNUNG" type="java.lang.String" not-null="false" length="80"/>
<property name="keywords" column="KEYWORDS" type="java.lang.String" not-null="false" length="100"/>
<property name="notiz" column="NOTIZ" type="java.lang.String" not-null="false" length="1000" />
<property name="useredit" column="USEREDIT" type="java.lang.String" not-null="false" length="10"/>
<property name="usereditdate" column="USEREDITDATE" type="java.util.Date" not-null="false" length="19"/>
<property name="userinsert" column="USERINSERT" type="java.lang.String" not-null="false" length="10"/>
<property name="userinsertdate" column="USERINSERTDATE" type="java.util.Date" not-null="false" length="19"/>
<set name="dokunwtSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Dokunwt" />
</set>
<set name="blsstrSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blsstr" />
</set>
<set name="blswa5Set" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blswa5" />
</set>
<set name="blswa6Set" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blswa6" />
</set>
<set name="blswa7Set" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blswa7" />
</set>
<set name="blssakSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blssak" />
</set>
<set name="blsrezxSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blsrezx" />
</set>
<set name="blsmisxSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blsmisx" />
</set>
<set name="blsnae5Set" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blsnae5" />
</set>
<set name="blsnae6Set" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blsnae6" />
</set>
<set name="blsnae7Set" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blsnae7" />
</set>
<set name="blsbasSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blsbas" />
</set>
<set name="blsbas0Set" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Blsbas0" />
</set>
<set name="doku2blsversionSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Doku2Blsversion" />
</set>
<set name="formel2blsversionSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="Formel2Blsversion" />
</set>
<set name="blsdatSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="at.dato.hibernate.blsberechnen.Blsdat" />
</set>
<set name="blsdaterrorSet" inverse="true">
<key column="BLSVERSIONID" />
<one-to-many class="at.dato.hibernate.blsberechnen.Blsdaterror" />
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:javax.servlet.ServletException: Servlet execution threw an exception
net.sf.wfnm.web.SessionBindingFilter.doFilter(SessionBindingFilter.java:49)
org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
Name and version of the database you are using:The generated SQL (show_sql=true):Debug level Hibernate log excerpt:Code: