-->
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: Query Entity / Collections
PostPosted: Fri Mar 16, 2007 5:37 am 
Newbie

Joined: Fri Mar 16, 2007 5:26 am
Posts: 4
Hi,

folgendes Problem:
Ich hab eine Entity CustomerConfiguration, die ein Set aus Area-Objekten enthält. Jedes dieser Area-Objekte enthält wiederrum ein Set aus SRAgreement-Objekten.

Was ich nun gern hätte: Ein komplettes CustomerConfiguration-Objekt aus der DB laden inkl. der initialisierten Sets.

Ich könnte natürlich alles mit inner join verknüpfen, allerdings bekomm ich dann mehrere Results und nicht das eigentliche Objekt.

Vermutlich steh ich auch nur auf dem Schlauch und es ist ganz einfach zu lösen...

Anbei Mapping-File:

Code:

<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="com.plecto.bimarp.ext.configuration.entity.CustomerConfiguration" table="CUST_CONFIG">
<id name="id" type="long" column="CUSTID">
  <generator class="com.plecto.bimarp.ext.dba.impl.IdGenerator">
     <param name="startValue">1</param>
     <param name="column">id</param>
     <param name="table">CustomerConfiguration</param>
  </generator>
</id>

<property name="customerName" type="string" column="CUSTOMERNAME"/>

<set name="areas" inverse="true" cascade="all" fetch="join" lazy="false">
   <key>
         <column name="custid"/>
   </key>
   <one-to-many class="com.plecto.bimarp.ext.configuration.entity.Area"/>
   
</set>
</class>

<class name="com.plecto.bimarp.ext.configuration.entity.Area" table="CUST_CONFIG_AREAS">
   <id name="id" type="long" column="AREAID">
     <generator class="com.plecto.bimarp.ext.dba.impl.IdGenerator">
           <param name="startValue">1</param>
           <param name="column">id</param>
           <param name="table">Area</param>
      </generator>
   </id>
   
   <property name="custId" type="long" column="CUSTID"/>
   <property name="areaName" type="string" column="AREANAME"/>
   
   <set name="sra" inverse="true" cascade="all" fetch="join" lazy="false">
     <key>
       <column name="areaid"/>
     </key>
     <one-to-many class="com.plecto.bimarp.ext.configuration.entity.SRAgreement"/>
   </set>
</class>

<class name="com.plecto.bimarp.ext.configuration.entity.SRAgreement" table="CUST_CONFIG_SR">
   <id name="id" type="long" column="SRID">
     <generator class="com.plecto.bimarp.ext.dba.impl.IdGenerator">
           <param name="startValue">1</param>
           <param name="column">id</param>
           <param name="table">SRAgreement</param>
      </generator>
   </id>
   
   <property name="areaId" type="long" column="AREAID"/>
   <property name="sender" type="string" column="SENDER"/>
   <property name="senderInterface" type="string" column="SENDERIF"/>
   <property name="senderInterfaceNamespace" type="string" column="SENDERIFNS"/>
   <property name="receiver" type="string" column="RECEIVER"/>
   <property name="receiverInterface" type="string" column="RECEIVERIF"/>
   <property name="receiverInterfaceNamespace" type="string" column="RECEIVERIFNS"/>

</class>
 
</hibernate-mapping>




Danke schon mal im Voraus!


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.