Mysql Views + Hibernate with Spring HibernateTemplate classes

Hi all,

I am experiencing strange problem for a month or so. I tried all posibilities as well as google but no luck so far.

xyz.hbm.xml defintion

<hibernate-mapping>

<class name="com.churchgroup.model.group.VWGroup" table="vw_groups" catalog="ahumc">

<id name="groupId" type="java.lang.Long">

<column name="groupId" />

</id>

<bag name="groupMemberDetails" cascade="all" lazy="false" table="vw_groupmemberdetails" outer-join="auto" where=" roleName ='Leader'">

<key>

<column name="groupId" />

</key>

<one-to-many class="com.churchgroup.model.group.VWGroupMemberDeails" node="" />

</bag>

</class>

</hibernate-mapping>

In above defintion, I have two views. When I iterate the main view VWGroup class, i will have many records (ex: 5 records ) of VWGroupMemberDeails for each VWGroup.

Here is the problem: All VWGroupMemberDeails list contains expected records (as per above ex: 5 records going to be in list). All 5 records are suppose to be different but One record repeated in list five times. When I query database, I could 5 different records. But In list i have same record repeated 5 times.

dear friends, can you help on this regards? I am totally clueless and have several open critical defects in production.

I really appreciate your help. Thank you so much

[1463 byte] By [SreeramJa] at [2007-11-27 2:32:30]
# 1
Here is the DAO call. Plz ignore node="" in hbm defintionList groups = getHibernateTemplate().find("from VWGroup where groupStatus!='D' and groupCatCode=?", groupType);Thank you!!!
SreeramJa at 2007-7-12 2:48:14 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Fields defined static by mistake maybe?
dcmintera at 2007-7-12 2:48:14 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Hi, You mean any of the class variables defined as a static. In my class, i have only serialVersionUID attribute defined as a static long. Remaining attributes doesn't have any static.Thank youSreeram
SreeramJa at 2007-7-12 2:48:14 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
Oh well, it was just a thought. There's nothing conspicuously wrong with your mapping. Could we see the implementation of VWGroup and VWGroupMemberDetails then please?
dcmintera at 2007-7-12 2:48:14 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
Set hibernate.show_sql to true and show it us. Likely there is something wrong in a join. Technically you have to do an INNER JOIN on this and not an OUTER JOIN, while you have set it to "auto".
BalusCa at 2007-7-12 2:48:14 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...