-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate returning two objects for every row in table.
PostPosted: Tue Mar 01, 2005 2:44 pm 
Regular
Regular

Joined: Tue Mar 01, 2005 2:35 pm
Posts: 60
Hibernate version:
2.1.89

Mapping documents:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

        <class name="eha.dao.EzMemb" table="EHA.ezMemb" mutable="false">
              <cache usage="read-only" />
                <id name="membid" type="string">
                        <generator class="assigned"/>
                </id>
                <property name="subssn"/>
                <property name="lastnm"/>
                <property name="firstnm"/>
                <property name="mi"/>
                <property name="patid"/>
                <property name="sex"/>
                <property name="street"/>
                <property name="city"/>
                <property name="state"/>
                <property name="zip"/>
                <property name="phone"/>
                <property name="birth" type="date"/>
                <property name="hpCode"/>
                <set name="claims" sort="natural" lazy="true">
                   <key column="membid"/>
                   <one-to-many class="eha.dao.Claim"/>
                </set>
                <set name="providerHistory" sort="natural" lazy="true">
                   <key column="membid"/>
                   <one-to-many class="eha.dao.EzMembPcp"/>
                </set>
                <set name="healthPlans" sort="natural" lazy="true">
               <key column="membid"/>
               <one-to-many class="eha.dao.EzMembHp"/>
            </set>
        </class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
retList = getHibernateTemplate().find(
    "FROM EzMemb m " +
    "WHERE m.patid = ?",
    member.getPatid()
);
Util.debug(Integer.toString(retList.size()));


Name and version of the database you are using:
SQL Server 2000 with JTDS

The generated SQL (show_sql=true):
Hibernate: select ... from EHA.ezMemb familymemb0_ where (familymemb0_.patid=? )

I plug the generated SQL directly into the database with the ID from the debugger and I get n records. However, when I run that code the size of the returned list is always 2n. Anyone seen this before? Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.