Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.x
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.acs.gs.juror.bo.Participant" table="INFORMIX.VOTERS">
<id name="participantNumber" column="PART_NO">
</id>
<property name="firstName" column="FNAME"/>
<property name="lastName" column="LNAME"/>
<component name="address" class="com.acs.gs.juror.bo.Address">
<property name="street" column="ADDRESS" type="string"/>
<property name="city" type="string"/>
<property name="state" type="string" />
<property name="zip" type="string" />
</component>
<property name="birthdate" type="timestamp" column="DOB"/>
<property name="homePhone" column="h_phone"/>
<property name="taxId" column="SIN"/>
<property name="gender" column="SEX"/>
<set name="pools" inverse="true">
<key column="PART_NO"/>
<one-to-many class="com.acs.gs.juror.bo.PoolInfo"/>
</set>
<component name="status" class="com.acs.gs.juror.bo.SourceStatus">
<property name="code" column="STATUS" />
</component>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.acs.gs.juror.bo.PoolInfo" table="INFORMIX.POOL">
<id name="participantNumber" column="PART_NO">
</id>
<property name="poolNumber" column="POOL_NO"/>
<property name="active" column="IS_ACTIVE"/>
<property name="firstName" column="fname"/>
<property name="lastName" column="lname"/>
<property name="city"/>
<property name="state"/>
<property name="zip"/>
<property name="dateDeferred" type="timestamp" column="DEF_DATE"/>
<property name="dateDisqualified" type="timestamp" column="DATE_DISQ"/>
<property name="dateExcused" type="timestamp" column="DATE_EXCUS"/>
<property name="dateOfBirth" type="timestamp" column="DOB"/>
<property name="dateNext" type="timestamp" column="NEXT_DATE"/>
<property name="dateReturn" type="timestamp" column="RET_DATE"/>
<property name="responded"/>
<property name="homePhone" column="H_PHONE"/>
<property name="workPhone" column="W_PHONE"/>
<property name="disqualifiedCode" column="DISQ_CODE"/>
<property name="excuseCode" column="EXC_CODE"/>
<property name="courtLocation" column="LOC_CODE"/>
<property name="numberAwol" column="NO_AWOL"/>
<property name="numberAttended" column="NO_ATTENDED"/>
<property name="numberFta" column="NO_FTA"/>
<property name="numberOfDeferralsPosted" column="NO_DEF_POS"/>
<property name="onCall" column="ON_CALL"/>
<property name="sequenceNumber" column="POOL_SEQ"/>
<many-to-one name="status"
column="STATUS"
class="com.acs.gs.juror.bo.PoolStatus"
fetch="join"
/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Using Spring
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
Informix 7.x
The generated SQL (show_sql=true):
Hibernate: select votersvo0_.part_no as part1_19_0_, votersvo0_.lname as lname19
_0_, votersvo0_.fname as fname19_0_, votersvo0_.address as address19_0_, votersv
o0_.city as city19_0_, votersvo0_.state as state19_0_, votersvo0_.zip as zip19_0
_, votersvo0_.h_phone as h8_19_0_, votersvo0_.dob as dob19_0_, votersvo0_.sex as
sex19_0_, votersvo0_.sin as sin19_0_, votersvo0_.date_selected1 as date12_19_0_
from voters votersvo0_ where votersvo0_.part_no=?
Debug level Hibernate log excerpt:
???
OK, my participant class has many PoolInfo instances just like the Voters as many Pool records. When I run the above query, I get only one PoolInfo class instead of the two that is in the database. Can anyone give me a guess as to why?
Thanks!