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
|