-->
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: relationship und sorting
PostPosted: Mon Nov 19, 2007 4:36 am 
Newbie

Joined: Sun Nov 18, 2007 9:47 am
Posts: 4
Hibernate version:2.2

hi, ich bin neu im bereich nhibernate und hab ein paar fragen zum relationmapping

ich hab die folgenden mappings:

Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="X" assembly="X">
  <class name="B" table="b">
   <id name="Id" column="id" type="Int32">
      <generator class="increment" />
    </id>
    <property name="Symbol">
      <column name="symbol" sql-type="varchar(16)" not-null="true" />
    </property>
    <property name="Priority">
      <column name="priority" sql-type="integer" not-null="true" />
    </property>
</class>
</hibernate-mapping>


Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="X" assembly="X">
  <class name="A" table="a">
   <id name="Id" column="id" type="Int32">
      <generator class="increment" />
    </id>
    <property name="Name">
      <column name="name" sql-type="text" not-null="true" />
    </property>
    <property name="BID">
      <column name="bid" sql-type="integer" not-null="true" />
    </property>
</class>
</hibernate-mapping>


tabellen sehen so aus

Code:
A.id | A.name | A.bid
------------------------
1   | foo  | 1
2   | bar  | 1
3   | foo  | 2
2   | xyz  | 1


Code:
B.id | B.symbol| B.priority
------------------------
1   | abc     | 50
2   | def     | 100


meine fragen:
1) wie erweitere ich meine mappings um die relation?
2) wie finde ich dann alle A's mit A.name = 'foo' sortiert nach B.priority?


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.