-->
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: Nesting queries on views in Hibernate
PostPosted: Fri Apr 25, 2008 2:36 pm 
Newbie

Joined: Fri Apr 25, 2008 2:19 pm
Posts: 2
Hi,

I have multiple views in my database, and am trying to create a hibernate mapping which links the views to each other:

VIEW1:
FIELD1
FIELD2
FIELD3 (KEY FOR VIEW2)

VIEW2:
FIELD1 (MAP TO VIEW1.FIELD3)
FIELD2
FIELD3 (KEY FOR VIEW3)

VIEW3:
FIELD1 (MAP TO VIEW2.FIELD3)
FIELD2

Each of the "foreign keys" is used as part of a one-to-many relationship. However, when I try running this mapping, Hibernate only returns all the results from VIEW1 with a single entry in the set representing VIEW2 and nothing from VIEW3. (I checked the DB, and there are about 40 records that should be returned for VIEW2, and many more for VIEW3.)

[code]
<set name="values" cascade="all,delete-orphan" lazy="false">
<key column="VIEW2_ID"/>
<one-to-many class="VIEW2" not-found="ignore"/>
</set>
[/code]

[code]
<class name="VIEW2" table="VIEW2">
<cache usage="read-only"/>
<id name="view2Id" type="string" column="VIEW2_ID" />
[/code]

When I perform a similar query with tables, I have no problem, but when I use views, it doesn't work.

Any ideas?
P.S. I'm using Hibernate 2 for this project


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 25, 2008 3:03 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
well, there is no mapping whatsoever for view3 ...

_________________
Gonzalo Díaz


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 25, 2008 3:40 pm 
Newbie

Joined: Fri Apr 25, 2008 2:19 pm
Posts: 2
I gave the first two levels for illustration purposes... the third level is defined in exactly the same way.


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.