-->
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.  [ 11 posts ] 
Author Message
 Post subject: Infinite loop with many-to-one association
PostPosted: Fri Nov 07, 2003 12:50 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 4:38 pm
Posts: 29
*** MAPPING ****
<hibernate-mapping>
<class name="Claim" table="claim">
<id column="claim_id" name="id" type="string">
<generator class="assigned"/>
</id>
<many-to-one name="tier" class="Company" column="tier_company_id" not-null="true"/>
<many-to-one name="policy" class="Policy" column="policy_id" outer-join="true"/>
<many-to-one name="claimant" class="Party" column="claimant_id" outer-join="true"/>
</class>
</hibernate-mapping>

*** QUERY ***
<query name="claims.for.tier1.with.activity.in.range">
<![CDATA[
SELECT
claim
FROM
com.pristx.wi.FhClaim AS claim
INNER JOIN FETCH
claim.tier AS company
WHERE
company.tier1CompanyId = :tier1CompanyId
AND
(
EXISTS
(
FROM
ClaimStatusHistory AS claimStatusHistory
WHERE
claim.id = claimStatusHistory.claimId
AND
claimStatusHistory.startDate >= :startDate
AND
claimStatusHistory.startDate <= :endDate
)
OR EXISTS
(
FROM
Payable AS payable
WHERE
claim.id = payable.claimId AND
(
(
(
(
payable.transactionTypeCode = 'C'
AND
payable.checkingAccountId <> 'PRS@@@@@@113589'
)
OR
(
payable.transactionTypeCode = 'R'
)
)
AND
payable.checkDate >= :startDate
AND
payable.checkDate <= :endDate
)
OR
(
payable.transactionTypeCode = 'V'
AND
payable.checkingAccountId <> 'PRS@@@@@@113589'
AND
payable.voidDate >= :startDate
AND
payable.voidDate <= :endDate
)
)
)
OR EXISTS
(
FROM
ReservePaid AS reservePaid
WHERE
claim.id = reservePaid.claimId
AND
reservePaid.reserveOrPaidCode = 'R'
AND
reservePaid.reserveDate >= :startDate
AND
reservePaid.reserveDate <= :endDate
)
)
]]>
</query>

*** CODE ***
Query query = session.getNamedQuery("claims.for.tier1.with.activity.in.range");
query.setString("tier1CompanyId", tier1.getId());
query.setTimestamp("startDate", range.getBeginDate());
query.setTimestamp("endDate", range.getEndDate());
results = query.list();

*** CONFIG ***
hibernate.dialect net.sf.hibernate.dialect.SybaseDialect
hibernate.cglib.use_reflection_optimizer=false
hibernate.show_sql true

*** PROBLEM ***
When executing this query after the first claim is loaded and then the attempt to load the policy and party occurs an infinite loop starts.

Program output:
Hibernate: select fhclaim0_.claim_id as claim_id0_, .....
Hibernate: select fhpolicy0_.policy_id as policy_id0_,.....
Hibernate: select fhparty0_.party_id as party_id0_,.....
Hibernate: select fhparty0_.party_id as party_id0_,.....
Hibernate: select fhparty0_.party_id as party_id0_,.....
Hibernate: select fhpolicy0_.policy_id as policy_id0_,.....
Hibernate: select fhparty0_.party_id as party_id0_,.....
Hibernate: select fhpolicy0_.policy_id as policy_id0_,.....
Hibernate: select fhparty0_.party_id as party_id0_,.....

....does not seem to stop until I terminate the program

Expected output:
Hibernate: select fhclaim0_.claim_id as claim_id0_, .....
Hibernate: select fhpolicy0_.policy_id as policy_id0_,.....
Hibernate: select fhparty0_.party_id as party_id0_,.....
Hibernate: select fhclaim0_.claim_id as claim_id0_, .....
Hibernate: select fhpolicy0_.policy_id as policy_id0_,.....
Hibernate: select fhparty0_.party_id as party_id0_,.....

Have I messed up the mapping? Is the query causing this? Any ideas?


Top
 Profile  
 
 Post subject: Forgot
PostPosted: Fri Nov 07, 2003 12:52 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 4:38 pm
Posts: 29
Using Hibernate 2.1 beta 6


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 12:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
No idea. Try to simplify + isolate the problem.


Top
 Profile  
 
 Post subject: Findings so far
PostPosted: Fri Nov 07, 2003 2:11 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 4:38 pm
Posts: 29
Commented out one mapping and then the other (policy and party)...got same results.

Removed FETCH from query and company started repeating also (before it was loaded with the claim).

So far looks to be due to the mapping and not the query. I will continue looking.


Top
 Profile  
 
 Post subject: Exceptions found
PostPosted: Fri Nov 07, 2003 2:45 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 4:38 pm
Posts: 29
Switched to Session.load and got the following exepctions:

Hibernate: select fhcompan1_.company_id as company_id0_, fhcompan1_.company_code as company_2_0_, fhcompan1_.company_group as company_3_0_, fhcompan1_.tier_type as tier_type0_, fhcompan1_.company_name as company_5_0_, fhcompan1_.tier1_company_id as tier1_co6_0_, fhcompan1_.tier2_company_id as tier2_co7_0_, fhcompan1_.tier3_company_id as tier3_co8_0_, fhcompan1_.tier4_company_id as tier4_co9_0_, fhcompan1_.tier5_company_id as tier5_c10_0_, fhcompan1_.tier6_company_id as tier6_c11_0_, fhcompan1_.tier1_name as tier1_name0_, fhcompan1_.tier2_name as tier2_name0_, fhcompan1_.tier3_name as tier3_name0_, fhcompan1_.tier4_name as tier4_name0_, fhcompan1_.tier5_name as tier5_name0_, fhcompan1_.tier6_name as tier6_name0_, fhcompan1_.address1 as address10_, fhcompan1_.address2 as address20_, fhcompan1_.city as city0_, fhcompan1_.state as state0_, fhcompan1_.zip_code as zip_code0_, fhcompan1_.county as county0_, fhcompan1_.federal_id as federal_id0_, fhcompan1_.phone1 as phone10_, fhcompan1_.phone2 as phone20_, fhcompan1_.fax as fax0_, fhcompan1_.checking_account_id as checkin28_0_, fhcompan1_.next_claim_num as next_cl29_0_, fhcompan1_.handler_hourly_rate as handler30_0_, fhcompan1_.clerical_hourly_rate as clerica31_0_, fhcompan1_.mileage_rate as mileage32_0_, fhcompan1_.photograph_rate as photogr33_0_, fhcompan1_.photocopy_rate as photoco34_0_, fhcompan1_.handler_office_percent as handler35_0_, fhcompan1_.clerical_office_percent as clerica36_0_, fhcompan1_.flat_rate_office_percent as flat_ra37_0_, fhcompan1_.expense_office_percent as expense38_0_, fhcompan1_.replication_flag as replica39_0_, fhcompan1_.on_notice_pct as on_noti40_0_, fhcompan1_.billing_service_id as billing41_0_, fhcompan1_.quantity_num as quantit42_0_, fhcompan1_.rate_amt as rate_amt0_, fhcompan1_.office_pct as office_pct0_, fhcompan1_.global_tier_yn as global_45_0_, fhcompan1_.tpa_insured_flag as tpa_ins46_0_, fhcompan1_.dba_name as dba_name0_, fhcompan1_.cross_reference_num as cross_r48_0_, fhcompan1_.claim_pay_max as claim_p49_0_, fhpolicy2_.policy_id as policy_id1_, fhpolicy2_.branch_id as branch_id1_, fhpolicy2_.tier1_company_id as tier1_co3_1_, fhpolicy2_.policy_num as policy_num1_, fhpolicy2_.primary_carrier_id as primary_5_1_, fhpolicy2_.policy_desc as policy_d6_1_, fhpolicy2_.deductible_amt as deductib7_1_, fhpolicy2_.aggregate_limit_amt as aggregat8_1_, fhpolicy2_.primary_holder_name as primary_9_1_, fhpolicy2_.secondary_holder_name as seconda10_1_, fhpolicy2_.holder_address1 as holder_11_1_, fhpolicy2_.holder_address2 as holder_12_1_, fhpolicy2_.holder_city as holder_13_1_, fhpolicy2_.holder_state as holder_14_1_, fhpolicy2_.holder_zip_code as holder_15_1_, fhpolicy2_.holder_phone as holder_16_1_, fhpolicy2_.holder_fax as holder_fax1_, fhpolicy2_.replication_flag as replica18_1_, fhpolicy2_.policy_begin_date as policy_19_1_, fhpolicy2_.policy_end_date as policy_20_1_, fhpolicy2_.policy_premium_amt as policy_21_1_, fhpolicy2_.cancellation_date as cancell22_1_, fhpolicy2_.global_yn as global_yn1_, fhparty3_.party_id as party_id2_, fhparty3_.claim_id as claim_id2_, fhparty3_.branch_id as branch_id2_, fhparty3_.party_type_code as party_ty4_2_, fhparty3_.open_close_status as open_clo5_2_, fhparty3_.open_close_date as open_clo6_2_, fhparty3_.party_num as party_num2_, fhparty3_.first_name as first_name2_, fhparty3_.middle_initial as middle_i9_2_, fhparty3_.last_name as last_name2_, fhparty3_.soc_sec_num as soc_sec11_2_, fhparty3_.address1 as address12_, fhparty3_.address2 as address22_, fhparty3_.city as city2_, fhparty3_.state as state2_, fhparty3_.zip_code as zip_code2_, fhparty3_.home_phone as home_phone2_, fhparty3_.work_phone as work_phone2_, fhparty3_.other_phone as other_p19_2_, fhparty3_.age as age2_, fhparty3_.sex as sex2_, fhparty3_.occupation_id as occupat22_2_, fhparty3_.department_id as departm23_2_, fhparty3_.injury_id as injury_id2_, fhparty3_.sickness_id as sicknes25_2_, fhparty3_.body_part_id as body_pa26_2_, fhparty3_.osha_200_id as osha_2027_2_, fhparty3_.pay_period as pay_period2_, fhparty3_.pay_type as pay_type2_, fhparty3_.avg_weekly_wage as avg_wee30_2_, fhparty3_.full_or_restricted as full_or31_2_, fhparty3_.in_litigation_yn as in_liti32_2_, fhparty3_.in_subrogation_yn as in_subr33_2_, fhparty3_.spouse_name as spouse_34_2_, fhparty3_.spouse_address1 as spouse_35_2_, fhparty3_.spouse_address2 as spouse_36_2_, fhparty3_.spouse_city as spouse_37_2_, fhparty3_.spouse_state as spouse_38_2_, fhparty3_.spouse_zip_code as spouse_39_2_, fhparty3_.spouse_age as spouse_age2_, fhparty3_.spouse_soc_sec_num as spouse_41_2_, fhparty3_.spouse_home_phone as spouse_42_2_, fhparty3_.spouse_work_phone as spouse_43_2_, fhparty3_.spouse_other_phone as spouse_44_2_, fhparty3_.number_of_dependents as number_45_2_, fhparty3_.driver_license_num as driver_46_2_, fhparty3_.vehicle_driver_yn as vehicle47_2_, fhparty3_.vehicle_passenger_yn as vehicle48_2_, fhparty3_.vehicle_owner_yn as vehicle49_2_, fhparty3_.pedestrian_yn as pedestr50_2_, fhparty3_.facts as facts2_, fhparty3_.represented_by_lawyer_yn as represe52_2_, fhparty3_.represented_by_doctor_yn as represe53_2_, fhparty3_.deductible_amt as deducti54_2_, fhparty3_.deductible_paid_yn as deducti55_2_, fhparty3_.premises_type as premise56_2_, fhparty3_.premises_description as premise57_2_, fhparty3_.premises_owner_name as premise58_2_, fhparty3_.premises_owner_address as premise59_2_, fhparty3_.premises_owner_phone as premise60_2_, fhparty3_.product_type as product61_2_, fhparty3_.product_description as product62_2_, fhparty3_.product_mfg_name as product63_2_, fhparty3_.product_mfg_address as product64_2_, fhparty3_.product_mfg_phone as product65_2_, fhparty3_.accident_location as acciden66_2_, fhparty3_.product_site_location as product67_2_, fhparty3_.name_of_fire_police_called as name_of68_2_, fhparty3_.replication_flag as replica69_2_, fhparty3_.as_of_status_code as as_of_s70_2_, fhparty3_.opened_date as opened_71_2_, fhparty3_.closed_date as closed_72_2_, fhparty3_.reopened_date as reopene73_2_, fhparty3_.birth_date as birth_date2_, fhparty3_.hire_date as hire_date2_, fhparty3_.death_date as death_date2_, fhparty3_.last_work_day_date as last_wo77_2_, fhparty3_.first_day_off_work_date as first_d78_2_, fhparty3_.return_to_work_date as return_79_2_, fhparty3_.spouse_birth_date as spouse_80_2_, fhparty3_.party_text1 as party_t81_2_, fhparty3_.party_text2 as party_t82_2_, fhparty3_.party_text3 as party_t83_2_, fhparty3_.party_text4 as party_t84_2_, fhparty3_.party_text5 as party_t85_2_, fhparty3_.party_code1 as party_c86_2_, fhparty3_.party_code2 as party_c87_2_, fhparty3_.party_code3 as party_c88_2_, fhparty3_.party_code4 as party_c89_2_, fhparty3_.party_code5 as party_c90_2_, fhparty3_.party_date1 as party_d91_2_, fhparty3_.party_date2 as party_d92_2_, fhparty3_.party_date3 as party_d93_2_, fhparty3_.party_date4 as party_d94_2_, fhparty3_.party_date5 as party_d95_2_, fhparty3_.party_numb1 as party_n96_2_, fhparty3_.party_numb2 as party_n97_2_, fhparty3_.party_numb3 as party_n98_2_, fhparty3_.party_numb4 as party_n99_2_, fhparty3_.party_numb5 as party_100_2_, fhparty3_.accident_description as accide101_2_, fhparty3_.agree_to_compensate as agree_102_2_, fhparty3_.aww_method as aww_method2_, fhparty3_.class_code as class_code2_, fhparty3_.subclass_code as subcla105_2_, fhparty3_.comp_rate as comp_rate2_, fhparty3_.controversion_yn as contro107_2_, fhparty3_.date_claim_denied as date_c108_2_, fhparty3_.date_dw3_received as date_d109_2_, fhparty3_.date_of_representation as date_o110_2_, fhparty3_.days_per_week as days_p111_2_, fhparty3_.denial_reason_code as denial112_2_, fhparty3_.denial_recession_date as denial113_2_, fhparty3_.denial_reason_description as denial114_2_, fhparty3_.employment_status as employ115_2_, fhparty3_.estimated_aww as estima116_2_, fhparty3_.fraud_indicator as fraud_117_2_, fhparty3_.initial_treatment_code as initia118_2_, fhparty3_.injury_description as injury119_2_, fhparty3_.injury_site_address1 as injury120_2_, fhparty3_.injury_site_address2 as injury121_2_, fhparty3_.injury_site_city as injury122_2_, fhparty3_.injury_site_state as injury123_2_, fhparty3_.injury_site_zip_code as injury124_2_, fhparty3_.marital_status as marita125_2_, fhparty3_.mco as mco2_, fhparty3_.mmi_date as mmi_date2_, fhparty3_.on_premises_yn as on_pre128_2_, fhparty3_.other_loss_condition as other_129_2_, fhparty3_.other_weekly_pay as other_130_2_, fhparty3_.percent_impairment as percen131_2_, fhparty3_.preferred_worker_yn as prefer132_2_, fhparty3_.prior_existence_yn as prior_133_2_, fhparty3_.represented_yn_dw3 as repres134_2_, fhparty3_.salary_continued_yn as salary135_2_, fhparty3_.surgery_required_yn as surger136_2_, fhparty3_.wages_paid_on_dol_yn as wages_137_2_, fhparty3_.year_last_exposed as year_l138_2_, fhparty3_.loss_condition_code as loss_c139_2_, fhparty3_.osha_private_yn as osha_p140_2_, fhparty3_.driver_license_state as driver141_2_, fhparty3_.property_id as proper142_2_, fhclaim0_.claim_id as claim_id3_, fhclaim0_.branch_id as branch_id3_, fhclaim0_.fh_claim_num as fh_claim3_3_, fhclaim0_.tier_claim_num as tier_cla4_3_, fhclaim0_.lob_id as lob_id3_, fhclaim0_.handler_id as handler_id3_, fhclaim0_.tier_company_id as tier_com7_3_, fhclaim0_.policy_id as policy_id3_, fhclaim0_.claimant_id as claimant9_3_, fhclaim0_.tier_contact_id as tier_co10_3_, fhclaim0_.bill_to_company_id as bill_to11_3_, fhclaim0_.received_date as receive12_3_, fhclaim0_.reported_date as reporte13_3_, fhclaim0_.loss_date as loss_date3_, fhclaim0_.lost_time_yn as lost_ti15_3_, fhclaim0_.in_hearing_yn as in_hear16_3_, fhclaim0_.controlling_state as control17_3_, fhclaim0_.loss_causation_id as loss_ca18_3_, fhclaim0_.accident_location_id as acciden19_3_, fhclaim0_.claim_type_id as claim_t20_3_, fhclaim0_.claim_status_id as claim_s21_3_, fhclaim0_.closure_method_id as closure22_3_, fhclaim0_.open_close_status as open_cl23_3_, fhclaim0_.closed_date as closed_24_3_, fhclaim0_.reopened_date as reopene25_3_, fhclaim0_.next_log_num as next_lo26_3_, fhclaim0_.billing_type as billing27_3_, fhclaim0_.billing_schedule_id as billing28_3_, fhclaim0_.final_bill_yn as final_b29_3_, fhclaim0_.close_after_final_bill_yn as close_a30_3_, fhclaim0_.flat_fee_bill_date as flat_fe31_3_, fhclaim0_.bill_comment_id as bill_co32_3_, fhclaim0_.replication_flag as replica33_3_, fhclaim0_.print_bill_type as print_b34_3_, fhclaim0_.print_bill_method as print_b35_3_, fhclaim0_.osha_yn as osha_yn3_, fhclaim0_.claim_text1 as claim_t37_3_, fhclaim0_.claim_text2 as claim_t38_3_, fhclaim0_.claim_text3 as claim_t39_3_, fhclaim0_.claim_text4 as claim_t40_3_, fhclaim0_.claim_text5 as claim_t41_3_, fhclaim0_.claim_code1 as claim_c42_3_, fhclaim0_.claim_code2 as claim_c43_3_, fhclaim0_.claim_code3 as claim_c44_3_, fhclaim0_.claim_code4 as claim_c45_3_, fhclaim0_.claim_code5 as claim_c46_3_, fhclaim0_.claim_date1 as claim_d47_3_, fhclaim0_.claim_date2 as claim_d48_3_, fhclaim0_.claim_date3 as claim_d49_3_, fhclaim0_.claim_date4 as claim_d50_3_, fhclaim0_.claim_date5 as claim_d51_3_, fhclaim0_.claim_numb1 as claim_n52_3_, fhclaim0_.claim_numb2 as claim_n53_3_, fhclaim0_.claim_numb3 as claim_n54_3_, fhclaim0_.claim_numb4 as claim_n55_3_, fhclaim0_.claim_numb5 as claim_n56_3_, fhclaim0_.catastrophe_number as catastr57_3_, fhclaim0_.claim_catastrophe_yn as claim_c58_3_, fhclaim0_.claim_category as claim_c59_3_, fhclaim0_.date_entered as date_en60_3_, fhclaim0_.duplicate_yn as duplica61_3_, fhclaim0_.old_claim_id as old_cla62_3_, fhclaim0_.payroll_state as payroll63_3_, fhclaim0_.policy_location_id as policy_64_3_, fhclaim0_.sic_code as sic_code3_, fhclaim0_.original_claim_number as origina66_3_, fhclaim0_.copyfrom_date as copyfro67_3_, fhclaim0_.copyto_date as copyto_68_3_ from fh_claim fhclaim0_ left outer join fh_company fhcompan1_ on fhclaim0_.tier_company_id=fhcompan1_.company_id left outer join fh_policy fhpolicy2_ on fhclaim0_.policy_id=fhpolicy2_.policy_id left outer join fh_party fhparty3_ on fhclaim0_.claimant_id=fhparty3_.party_id where fhclaim0_.claim_id=?
Nov 7, 2003 12:41:49 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: HY010
Nov 7, 2003 12:41:49 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 2.
Nov 7, 2003 12:41:49 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: HY010
Nov 7, 2003 12:41:49 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 2.
Nov 7, 2003 12:41:49 PM net.sf.hibernate.JDBCException <init>
SEVERE: could not load: [com.pristx.wi.FhClaim#BPI@@@@00000000]
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 2.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.validateColumnIndex(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
at net.sf.hibernate.type.StringType.get(StringType.java:14)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:66)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:490)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:443)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:412)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:351)
at net.sf.hibernate.loader.Loader.doResultSet(Loader.java:185)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:111)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:663)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:678)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:429)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2122)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1926)
at com.pristx.wi.data.FhClaimDelegate.findClaimById(FhClaimDelegate.java:50)
at com.pristx.wi.FhClaim.findClaimById(FhClaim.java:875)
at com.pristx.wi.FhClaim.main(FhClaim.java:883)
net.sf.hibernate.JDBCException: could not load: [com.pristx.wi.FhClaim#BPI@@@@00000000]
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:432)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2122)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1926)
at com.pristx.wi.data.FhClaimDelegate.findClaimById(FhClaimDelegate.java:50)
at com.pristx.wi.FhClaim.findClaimById(FhClaim.java:875)
at com.pristx.wi.FhClaim.main(FhClaim.java:883)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 2.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.validateColumnIndex(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
at net.sf.hibernate.type.StringType.get(StringType.java:14)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:66)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:490)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:443)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:412)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:351)
at net.sf.hibernate.loader.Loader.doResultSet(Loader.java:185)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:111)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:663)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:678)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:429)
... 6 more


Top
 Profile  
 
 Post subject: Nevermind
PostPosted: Fri Nov 07, 2003 3:02 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 4:38 pm
Posts: 29
Above exceptions were fixed by adding outer-join="false" to party mapping, but still does not fix original problem.

Any more ideas you can think of that I should try?


Top
 Profile  
 
 Post subject: Claim joined with company
PostPosted: Fri Nov 07, 2003 3:37 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 4:38 pm
Posts: 29
**** QUERY 1 **** Works!!!

</query>
<query name="claim.by.id">
<![CDATA[
FROM
com.pristx.wi.FhClaim AS claim
WHERE
claim.id = :claimId
]]>
</query>


**** QUERY 2 **** Does not work!!!!!

<query name="claims.for.tier1">
<![CDATA[
SELECT
claim
FROM
com.pristx.wi.FhClaim AS claim
INNER JOIN
claim.tier AS company
WHERE
company.tier1CompanyId = :tier1CompanyId
]]>
</query>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 5:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Now, turn on Hibernate debug-level logging, and see exactly what Hibernate thinks its doing in both cases.


Top
 Profile  
 
 Post subject: I am Jack's wasted time
PostPosted: Fri Nov 07, 2003 5:55 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 4:38 pm
Posts: 29
OK I feel foolish now, it would appear that all the claims are loaded first and then Hibernate proceeds to load all of those claims policies and parties after that. I was incorrectly expecting it to load one claim at a time, sorry for the post. I did learn more about Hibernate logging today so that should at least prevent similar posts in the future (by me at least).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 6:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Have you had a little think about how cool and performance-enhancing it is that Hibernate waits till the end of the first ResultSet before trying to resolve associations and load associated objects?

That was quite hard to do ;-)


Top
 Profile  
 
 Post subject: =)
PostPosted: Fri Nov 07, 2003 6:10 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 4:38 pm
Posts: 29
Yes many thanks for the well written code!


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

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.