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: Need help Querying from unrelated tables!
PostPosted: Sun Jan 22, 2006 9:59 pm 
Beginner
Beginner

Joined: Sun Jan 22, 2006 8:47 pm
Posts: 31
Hi,
Iam a newbie to Hibernate..Iam trying some example which iam not able to do.pls help.

I hve 2 tables:

Person (pid ,firstName)-->(mapped to class Person)
Contact(cid,info)-->(mapped to class Contact)
_____________________________________
<hibernate-mapping>
<class name="Contact" table="Contact">
<id name="cid" type="int" column="cid" >
<generator class="assigned"/>
</id>

<property name="info">
<column name="info" />
</property>
</hibernate-mapping>
__________________________________________
<hibernate-mapping>
<class name="Person" table="Person">
<id name="pid" type="int" column="pid" >
<generator class="assigned"/>
</id>

<property name="firstName">
<column name="firstName" />
</property>

</hibernate-mapping>
_______________________________
There is no relation b/w the two tables,i want to run a query:

select cid,info from Contact as contact, Person as person where contact.cid=person.pid;


My dbt is there is no join b/w the two tables and no primary key n foreign key relationship.Iam not able to execute this query..Any help abt wht to do will be grtly appreciated..

Thnx.
Mysha.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 22, 2006 11:13 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
you can do it - relation isn't required


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 22, 2006 11:22 pm 
Beginner
Beginner

Joined: Sun Jan 22, 2006 8:47 pm
Posts: 31
Iam not getting the result..Pls can u be little clear abt how to do.
Thnx.


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.