-->
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: Join mit Teil von einem Compound Key
PostPosted: Sun Dec 17, 2006 1:19 pm 
Newbie

Joined: Sun Dec 17, 2006 1:11 pm
Posts: 1
Hallo!

Ich habe ein Problem bei einem JOIN zwischen zwei Tabellen, wobei eine Tabelle einen Compound Key hat. Die Mappings sehen folgendermaßen aus:

<?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">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="RuleResult" table="ruleresult" catalog="earlywarner">
<composite-id name="id" class="RuleResultId">
<key-property name="ruleId" type="integer">
<column name="Rule_ID" />
</key-property>
<key-property name="evaluationDayId" type="date">
<column name="Evaluation_Day_ID" length="10" />
</key-property>
<key-property name="dwhStatus" type="string">
<column name="DWH_Status" length="2" />
</key-property>
<key-property name="lastModifiedTs" type="timestamp">
<column name="Last_Modified_TS" length="19" />
</key-property>
</composite-id>
<property name="ruleStatus" type="short">
<column name="Rule_Status" not-null="true" />
</property>
<property name="executionStartTime" type="timestamp">
<column name="Execution_Start_Time" length="19" />
</property>
<property name="executionEndTime" type="timestamp">
<column name="Execution_End_Time" length="19" />
</property>
<property name="executionDayId" type="date">
<column name="Execution_Day_ID" length="10" not-null="true" />
</property>
<property name="result" type="double">
<column name="Result" precision="10" not-null="true" />
</property>
</class>
</hibernate-mapping>



<?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">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="RuleRecipientMapping" table="rulerecipientmapping" catalog="earlywarner">
<id name="ruleRecipientMappingId" type="integer">
<column name="Rule_Recipient_Mapping_ID" />
<generator class="increment"></generator>
</id>
<property name="ruleId" type="integer">
<column name="Rule_ID" not-null="true" />
</property>
<property name="recipientId" type="integer">
<column name="Recipient_ID" not-null="true" />
</property>
</class>
</hibernate-mapping>


Nun möchte ich die beiden Tabellen folgendermaßen joinen:

String hsql = "select rr.Rule_ID, rr.Rule_Status, rr.Evaluation_Day_ID, rr.Result from RuleResult as rr, RuleRecipientMapping as rrm where rr.Rule_ID=rrm.Rule_ID and rrm.Recipient_ID=" + _recipient.getRecipientId() + " and rr.Evaluation_Day_Id='" + _date + "' and rr.DWH_Status='AC'";
Query query = session.createQuery(hsql);

Ich bekomme die folgende Fehlermeldung:

could not resolve property: Rule_ID of: RuleResult

was mir auch einleuchtet, da Rule_ID Teil des Compound Key ist. Wie würde man das am besten lösen? Danke im voraus,
Tobi


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.