We are using session.createCriteria(HLink.class) method to retrieving records from table but it is pulling duplicate records in list.
When I see in the list objects it showing duplicate records of first row from table.
Below is the hibernate mapping file
<hibernate-mapping package="com.stockmann.framework.service.hierarchy">
<class name="HLink" table="STOCKMANN.HLINK" lazy="true">
<composite-id>
<key-property name="linkId" column="LINKID" type="integer"/>
<key-property name="fromHierarchy" column="FROMHIERARCHY" type="integer"/>
<key-property name="fromNode" column="FROMNODE" type="integer"/>
</composite-id>
<property name="toHierarchy" column="TOHIERARCHY" type="integer"/>
<property name="toNode" column="TONODE" type="integer"/>
</class>
</hibernate-mapping>
When I tried with query in database it is returning correct records.
select *
from stockmann.hlink
where LINKID = 130
and FROMHIERARCHY = 1
and FROMNODE = 3743
and TOHIERARCHY = 30;
Records are :
130 1 3743 30 8
130 1 3743 30 186
130 1 3743 30 190
But when i see in List object in java it is showing as below:
List object :[
com.stockmann.framework.service.hierarchy.HLink@695fc665[linkId=130,fromHierarchy=1,fromNode=3743,toHierarchy=30,toNode=8],
com.stockmann.framework.service.hierarchy.HLink@695fc665[linkId=130,fromHierarchy=1,fromNode=3743,toHierarchy=30,toNode=8],
com.stockmann.framework.service.hierarchy.HLink@695fc665[linkId=130,fromHierarchy=1,fromNode=3743,toHierarchy=30,toNode=8]
]
Please help me in this to get actual records from table instead one record duplication.