-->
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: XML Mapping
PostPosted: Thu Sep 23, 2004 7:16 am 
Newbie

Joined: Wed Sep 08, 2004 8:23 am
Posts: 2
Hibernate version:

hibernate 2

Mapping documents:

<?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="at.univie.auv.redbaron.model.MetaGruppen" table="META_GRUPPEN">
<meta attribute="class-description">
@author ZAL
</meta>

<id name="tid" column="TID">
<generator class="at.univie.auv.util.hibernate.TidGenerator">
<param name="table">META_GRUPPEN</param>
</generator>
</id>

<property name="i3vUserId" column="I3V_USER_ID" type="double" not-null="false"/>

<property name="i3vDate" column="I3V_DATE" type="string" not-null="false"/>

<property name="name" column="Name" type="string" not-null="false"/>

<many-to-one name="application" column="I3V_FILE_ID"
class="at.univie.auv.redbaron.model.I3VFile"
insert="true" update="true" cascade="all" />

<many-to-one name="displayType" column="META_DARSTELLUNG_TYP_ID"
class="at.univie.auv.redbaron.model.MetaDarstellungstyp"
insert="true" update="true" cascade="all"/>

<set name="metaGruppenSprache" lazy="true" cascade="all">
<key column="RELATION"/>
<one-to-many class="at.univie.auv.redbaron.model.MetaGruppenSprache" />
</set>

<set name="keys" table="META_GRUPPEUNTEROBER_HBEZ" lazy="true" cascade="all">
<key column="META_GRUPPEN_ID"/>
<many-to-many column="META_GRUPPEN_ID2"
class="at.univie.auv.redbaron.model.MetaGruppen"/>
</set>

</class>

<query name="getPagesByApplication">
<![CDATA[from MetaGruppen as gruppe
where gruppe.application.tid = :tid
and gruppe.displayType.code = :typeName ]]>
</query>

<query name="getKeysByPage">
<![CDATA[from MetaGruppen as gruppe
where gruppe.application.tid = :tid
and gruppe.displayType.code = :typeName
and gruppe.tid = :pageTid ]]>
</query>

</hibernate-mapping>


hello everybody ...

i've got one question concerning this mapping file or better this block of the mapping file:

<set name="keys" table="META_GRUPPEUNTEROBER_HBEZ" lazy="true" cascade="all">
<key column="META_GRUPPEN_ID"/>
<many-to-many column="META_GRUPPEN_ID2"
class="at.univie.auv.redbaron.model.MetaGruppen"/>

this is a recursive relation to the object itself.

i've read a lot of things about such recursive relations but there are always one-to-many relations mentioned etc. but i'm no sure how to do it in my case ...
now may question: ist the mapping correct as it is or not?
is it recommended to make it in such a way - because it seems to work but unfortunatly when i try to lazy load these values (with spring) i get "no session or session closed" ... when i remove the lazy attribute everthing works fine but very slow ;-)

any help is appreciated

thanx

tuor


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.