-->
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: Nested Queries: Mapping a class to multiple tables
PostPosted: Mon Oct 08, 2007 8:33 am 
Newbie

Joined: Sun Oct 07, 2007 6:37 pm
Posts: 3
Hello,
We are trying to use Hibernate with one of the existing legacy DB systems. We have a requirement where we need to map a query like the one below to a java object and I would like to know if it is possible.

DB SQL:

select A.F1,A.F2,E.F3,E.F4
from T1 A, T2 B, (select C.F3 AS F3, D.F4 AS F4 from T3 C, T4 D where T3.F4 = T4.F5) E
where A.F3 = B.F1 AND B.F2 = E.F3

Here are the tricky parts

1. SELECT columns doesn't include any fields from Table T2(B). T2 is only used as a mapping table between A and C. Is it possible to have tables in Hibernate without mapping columns to any Java classes
2. Table E is actually a nested query resultset

Could anyone let me know if this is something that can be implemented using Hibernate?
One alternative is to define a DB view and then map the class to the view but I am looking to avoid creating new DB objects.

Please advise

Thanks,
SG


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.