Hello
I have the following many-to-one entries in a hbm file
mapping file entries:
Code:
<many-to-one name="tcProviderLookup" class="TcProviderLookup" fetch="select">
<column name="TC_PROVIDER_CODE" precision="10" scale="0" not-null="true"/>
</many-to-one>
<many-to-one name="stateDistrictLookup" class="StateDistrictLookup" insert="false" update="false" not-found="exception">
<column name="STATE_DISTRICT_CODE" length="2"/>
</many-to-one>
<many-to-one name="suitNatureLookup" class="SuitNatureLookup" fetch="select">
<column name="SUIT_NATURE_CODE" precision="10" scale="0"/>
</many-to-one>
<many-to-one name="dateTypeLookup" class="DateTypeLookup" fetch="select">
<column name="FILED_DATE_TYPE_CODE" precision="3" scale="0"/>
</many-to-one>
<many-to-one name="documentKindLookup" class="DocumentKindLookup" fetch="select">
<column name="DOC_KIND_CODE" precision="10" scale="0"/>
</many-to-one>
<many-to-one name="countyLookup" class="CountyLookup" fetch="select">
<column name="COUNTY_CODE" precision="10" scale="0"/>
</many-to-one>
<many-to-one name="tcLabelLookup" class="TcLabelLookup" fetch="select">
<column name="TC_LABEL_CODE" precision="10" scale="0"/>
</many-to-one>
<many-to-one name="memTabLookup" class="MemTabLookup" fetch="select">
<column name="MEM_TAB_CODE" length="1"/>
</many-to-one>
When I insert the record a fetch is executed for all of the many-to-one associations. I would assume this is trying to resolve whether the foreign key exists. Is there a way to let the database handle this - meaning I do not want to do all of this pre-fetching (see below) prior to the insert.
Hibernate SQL:Code:
Hibernate:
/* get current state com.west.mds.caselaw.TcProviderLookup */ select
tcprovider_.TC_PROVIDER_CODE,
tcprovider_.TC_PROVIDER_NAME as TC2_18_
from
MACHV.TC_PROVIDER_LOOKUP tcprovider_
where
tcprovider_.TC_PROVIDER_CODE=?
Hibernate:
/* get current state com.west.mds.caselaw.StateDistrictLookup */ select
statedistr_.STATE_DISTRICT_CODE,
statedistr_.STATE_DISTRICT_DESC as STATE2_20_
from
MACHV.STATE_DISTRICT_LOOKUP statedistr_
where
statedistr_.STATE_DISTRICT_CODE=?
Hibernate:
/* get current state com.west.mds.caselaw.SuitNatureLookup */ select
suitnature_.SUIT_NATURE_CODE,
suitnature_.SUIT_NATURE_DESC as SUIT2_32_
from
MACHV.SUIT_NATURE_LOOKUP suitnature_
where
suitnature_.SUIT_NATURE_CODE=?
Hibernate:
/* get current state com.west.mds.caselaw.DateTypeLookup */ select
datetypelo_.DATE_TYPE_CODE,
datetypelo_.DATE_TYPE_TEXT as DATE2_31_
from
MACHV.DATE_TYPE_LOOKUP datetypelo_
where
datetypelo_.DATE_TYPE_CODE=?
Hibernate:
/* get current state com.west.mds.caselaw.CountyLookup */ select
countylook_.COUNTY_CODE,
countylook_.STATE_DISTRICT_CODE as STATE2_19_,
countylook_.US_DISTRICT_COURT_CODE as US3_19_,
countylook_.COUNTY as COUNTY19_,
countylook_.COUNTY_TERM as COUNTY5_19_,
countylook_.COUNTY_TERM_CODE as COUNTY6_19_,
countylook_.DISTRICT as DISTRICT19_,
countylook_.DIVISION as DIVISION19_,
countylook_.APPELLATE_COURT as APPELLATE9_19_
from
MACHV.COUNTY_LOOKUP countylook_
where
countylook_.COUNTY_CODE=?
Hibernate:
/* get current state com.west.mds.caselaw.TcLabelLookup */ select
tclabelloo_.TC_LABEL_CODE,
tclabelloo_.TC_HEADING_CODE as TC2_15_,
tclabelloo_.TC_LABEL as TC3_15_,
tclabelloo_.TC_LABEL_SORT_NUMBER as TC4_15_
from
MACHV.TC_LABEL_LOOKUP tclabelloo_
where
tclabelloo_.TC_LABEL_CODE=?
Hibernate:
/* get current state com.west.mds.caselaw.MemTabLookup */ select
memtablook_.MEM_TAB_CODE,
memtablook_.MEM_TAB_DESC as MEM2_14_
from
MACHV.MEM_TAB_LOOKUP memtablook_
where
memtablook_.MEM_TAB_CODE=?
Hibernate:
/* insert com.west.mds.caselaw.DocumentFamily
*/ insert
into
MACHV.CASE
(TC_PROVIDER_CODE, SUIT_NATURE_CODE, FILED_DATE_TYPE_CODE, DOC_KIND_CODE, COUNTY_CODE, TC_LABEL_CODE, MEM_TAB_CODE, SERIAL_NUMBER, ELECTRONIC_ID, FILED_DATE, RECORD_STATUS, APPENDIX_FLAG, BLOCKED_FLAG, SERIAL_CENTURY, REPLACING_SERIAL_NUMBER, ON_WESTLAW_FLAG, KEY_CITE_COLOR_CODE, INSTACITE_SUPPRESS_FLAG, ON_NORM_FLAG, TC_DOC_FLAG, FULL_TEXT_CODE, CREATE_USER, CREATE_DATE, MODIFY_USER, MODIFY_DATE, PATENT_APPLICATION_DATE, DMS_PUB_ID, CLIP_DATE, JUDGE, CLERK, PATENT_INVENTOR, PATENT_ASSIGNEE, NOTES, CONTEXT, LEGACY_ID, TC_DOC_HEADING, ADJUSTED_CITE_WORKFLOW_DATE, CASE_ABSTRACT_FLAG, CAUSE, CASE_UUID)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
thanks,
Tom