|
Create Table: Test_Table1 with primary key testId1, testId2 Test_Table2 with primary key testId3, testId4 & testid5 as normal column.
Create View: Test_View select * from Test_Table1 , Test_Table2;
Hibernate Mapping for Test_View: <class name="Testview" table="Test_View" > <composite-id name="testviewID" class="TestviewID"> <key-property name="testId1" type="java.lang.String"> <column name="testId1" length="20" /> </key-property> <key-property name="testId2" type="java.lang.String"> <column length="16" name="testId2" /> </key-property> <key-property name="cusipIssueNumber" type="java.lang.String"> <column length="12" name="CUSIP_ISSUE_NUMBER" /> </key-property> <key-property name="testId3" type="java.lang.String"> <column length="1" name="testId3" /> </key-property> <key-property name="testId4" type="java.lang.String"> <column name="testId4" length="10" /> </key-property> <key-property name="testId5" type="java.lang.Long"> <column name="testId5" length="10" /> </key-property> </composite-id>
Now suppose for one of the record in DB the testId5 is null then using org.hibernate.ScrollableResults to get the data from view. scrollableResults = criteria.scroll(ScrollMode.FORWARD_ONLY); returning null element in the result list. Actual: Hibernate is loading the row with null object in between the list returned as shown below: [testObj1, testobj2, null, testobj3] Expected: HIbernate should ignore that row or it should throw as error. Let me know if need more information on this.
|