-->
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.  [ 3 posts ] 
Author Message
 Post subject: How do you create joins between two or more tables in hibern
PostPosted: Fri Dec 08, 2006 12:17 pm 
Regular
Regular

Joined: Fri Nov 03, 2006 4:57 pm
Posts: 60
How do you create joins between two or more tables in hibernate? is that possible...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 8:35 pm 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
most of the examples do it, what is the problem!?

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 12, 2006 12:58 pm 
Regular
Regular

Joined: Fri Nov 03, 2006 4:57 pm
Posts: 60
I have the following sql and want to make sure that the mapping required for this query are correct:

select trans.date, con.type, ai.item
from Transaction tran, Condition con, AssignedItem ai
where tran.id = ai.transaction.id
and con.id = ai.condition.id
and tran.department=:deptNum

plus do i need the many-to-one mapping for the above query also in the Transaction and Condition table as well
or just plain mappings for those

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="AssignedItem" table="AssignedItem">
<id name="id" column="id">
<generator class="native"/>
</id>
<property name="item" column="item"/>

<property name="ai_trans_id" column="trans_id"/>
<property name="ai_con_id" column="con_id"/>

<property name="title"/>

<many-to-one column="ai_con_id" class="transactions"/>

<many-to-one column="ai_con_id" class="condition"/>

</class>


</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.