Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Jobs and Jobpackage are associated with many-to-one relation. Many jobs can be present in one JobPackage.
Hibernate version:
2.1.8
Mapping documents:
<hibernate-mapping>
<class name="com.boeing.tsas.castle.data.transferobjects.JobPackage" table="job_package">
<id name="packageId" column="PACKAGE_ID">
<generator class="increment"/>
</id>
<property name="jobPackageName" column="JOB_PACKAGE_NAME"/>
<property name="subject" column="SUBJECT"/>
<property name="archiveDate" column="ARCHIVE_DATE"/>
<property name="history" column="HISTORY"/>
<property name="revisionLevel" column="REVISION_LEVEL"/>
<property name="revisionNote" column="REVISION_NOTE"/>
<property name="saFolderId" column="SA_FOLDER_ID"/>
<property name="status" column="STATUS"/>
<property name="problemFrequency" column="PROBLEM_FREQUENCY"/>
<property name="sirp" column="SIRP"/>
<property name="initiatorBemsId" column="INITIATOR_BEMS_ID"/>
<property name="primaryComponent" column="PRIMARY_COMPONENT"/>
<property name="libraryLocationCode" column="LIBRARY_LOCATION_CODE"/>
<property name="publishedInd" column="PUBLISHED_IND" />
<property name="analysisDescriptionTextId" column="ANALYSIS_DESCRIPTION_TEXT_ID"/>
<property name="primaryDiscrepancyKeywordId" column="PRIMARY_DISCREPANCY_KEYWORD_ID"/>
<property name="ata" column="ATA"/>
<property name="chargeableInd" column="CHARGEABLE_IND"/>
<property name="problemTextId" column="PROBLEM_TEXT_ID"/>
<property name="libraryLocation" column="LIBRARY_LOCATION"/>
<property name="noteTextId" column="NOTE_TEXT_ID"/>
<property name="libraryBookVolumn" column="LIBRARY_BOOK_VOLUMN"/>
<property name="itarContentInd" column="ITAR_CONTENT_IND"/>
<property name="comrContentInd" column="COMR_CONTENT_IND"/>
<property name="earContentInd" column="EAR_CONTENT_IND"/>
<property name="modelId" column="MODEL_ID"/>
<property name="requestersDocument" column="REQUESTERS_DOCUMENT"/>
<property name="jobPackageType" column="JOB_PACKAGE_TYPE"/>
<property name="writeLockingBemsId" column="WRITE_LOCKING_BEMS_ID"/>
<property name="writeLockingDate" column="WRITE_LOCKING_DATE"/>
<property name="ownerBemsId" column="OWNER_BEMS_ID"/>
<!-- bi-directional one-to-many association to Jobs -->
<set name="jobs" lazy="true" inverse="true" cascade="all">
<key column="PACKAGE_ID"/>
<one-to-many class="com.boeing.tsas.castle.data.transferobjects.Jobs"/>
</set>
</class>
-----------------------------------------------------------------------------
<hibernate-mapping>
<class name="com.boeing.tsas.castle.data.transferobjects.Jobs" table="job">
<id name="jobId" column="JOB_ID" unsaved-value="null">
<generator class="increment">
</generator>
</id>
<!--<property name="packageId" column="PACKAGE_ID"/>-->
<property name="jobName" column="JOB_NAME"/>
<property name="timeDateOut" column="TIME_DATE_OUT"/>
<property name="jobDateDue" column="JOB_DATE_DUE"/>
<property name="jobDateIn" column="JOB_DATE_IN"/>
<property name="jobDateLoggedIn" column="JOB_DATE_LOGGED_IN"/>
<property name="jobExtendedDateDue" column="JOB_EXTENDED_DATE_DUE"/>
<property name="jobPriority" column="JOB_PRIORITY"/>
<property name="jobSpecificQuestion" column="JOB_SPECIFIC_QUESTION"/>
<property name="jobStatus" column="JOB_STATUS"/>
<property name="jobSubject" column="JOB_SUBJECT"/>
<property name="jobType" column="JOB_TYPE"/>
<property name="requester" column="REQUESTER"/>
<property name="requesterBemsId" column="REQUESTER_BEMS_ID"/>
<property name="dispSummary" column="DISP_SUMMARY"/>
<property name="assigneeBemsId" column="ASSIGNEE_BEMS_ID"/>
<property name="initiatorBemsId" column="INITIATOR_BEMS_ID"/>
<property name="noteTextId" column="NOTE_TEXT_ID"/>
<property name="approverNewInd" column="APPROVER_NEW_IND"/>
<property name="approverClearInd" column="APPROVER_CLEAR_IND"/>
<property name="initiatorNewInd" column="INITIATOR_NEW_IND"/>
<property name="initiatorClearInd" column="INITIATOR_CLEAR_IND"/>
<property name="assigneeNewInd" column="ASSIGNEE_NEW_IND" />
<property name="assigneeClearInd" column="ASSIGNEE_CLEAR_IND"/>
<property name="approverBemsId" column="APPROVER_BEMS_ID"/>
<many-to-one name="jobPackage"
column="PACKAGE_ID"
class="com.boeing.tsas.castle.data.transferobjects.JobPackage"
not-null="true"
unique="true"
cascade="all"
outer-join="true"
update="true"
insert="true">
<!-- Used as a DDL hint -->
<!--<column name="PACKAGE_ID" not-null="true" /> -->
</many-to-one>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
jobList = hibernateSession.find("from Job in class com.boeing.tsas.castle.data.transferobjects.Jobs");
System.out.println("xxxxxxxx Job List size():"+ jobList.size());
Full stack trace of any exception that occurs:
No exception
Name and version of the database you are using:
Oracle 9.x
The generated SQL (show_sql=true):
Hibernate: select Job.JOB_ID as JOB_ID, Job.JOB_NAME as JOB_NAME, Job.TIME_DATE_OUT as TIME_DAT3_, Job.JOB_DATE_DUE as JOB_DATE4_, Job.JOB_DATE_IN as JOB_DATE5_, Job.JOB_DATE_LOGGED_IN as JOB_DATE6_, Job.JOB_EXTENDED_DATE_DUE as JOB_EXTE7_, Job.JOB_PRIORITY as JOB_PRIO8_, Job.JOB_SPECIFIC_QUESTION as JOB_SPEC9_, Job.JOB_STATUS as JOB_STATUS, Job.JOB_SUBJECT as JOB_SUB11_, Job.JOB_TYPE as JOB_TYPE, Job.REQUESTER as REQUESTER, Job.REQUESTER_BEMS_ID as REQUEST14_, Job.DISP_SUMMARY as DISP_SU15_, Job.ASSIGNEE_BEMS_ID as ASSIGNE16_, Job.INITIATOR_BEMS_ID as INITIAT17_, Job.NOTE_TEXT_ID as NOTE_TE18_, Job.APPROVER_NEW_IND as APPROVE19_, Job.APPROVER_CLEAR_IND as APPROVE20_, Job.INITIATOR_NEW_IND as INITIAT21_, Job.INITIATOR_CLEAR_IND as INITIAT22_, Job.ASSIGNEE_NEW_IND as ASSIGNE23_, Job.ASSIGNEE_CLEAR_IND as ASSIGNE24_, Job.APPROVER_BEMS_ID as APPROVE25_, Job.PACKAGE_ID as PACKAGE_ID from job Job
[8/10/05 17:28:18:293 PDT] 671a0820 SystemOut O Hibernate: select jobpackage0_.PACKAGE_ID as PACKAGE_ID0_, jobpackage0_.JOB_PACKAGE_NAME as JOB_PACK2_0_, jobpackage0_.SUBJECT as SUBJECT0_, jobpackage0_.ARCHIVE_DATE as ARCHIVE_4_0_, jobpackage0_.HISTORY as HISTORY0_, jobpackage0_.REVISION_LEVEL as REVISION6_0_, jobpackage0_.REVISION_NOTE as REVISION7_0_, jobpackage0_.SA_FOLDER_ID as SA_FOLDE8_0_, jobpackage0_.STATUS as STATUS0_, jobpackage0_.PROBLEM_FREQUENCY as PROBLEM10_0_, jobpackage0_.SIRP as SIRP0_, jobpackage0_.INITIATOR_BEMS_ID as INITIAT12_0_, jobpackage0_.PRIMARY_COMPONENT as PRIMARY13_0_, jobpackage0_.LIBRARY_LOCATION_CODE as LIBRARY14_0_, jobpackage0_.PUBLISHED_IND as PUBLISH15_0_, jobpackage0_.ANALYSIS_DESCRIPTION_TEXT_ID as ANALYSI16_0_, jobpackage0_.PRIMARY_DISCREPANCY_KEYWORD_ID as PRIMARY17_0_, jobpackage0_.ATA as ATA0_, jobpackage0_.CHARGEABLE_IND as CHARGEA19_0_, jobpackage0_.PROBLEM_TEXT_ID as PROBLEM20_0_, jobpackage0_.LIBRARY_LOCATION as LIBRARY21_0_, jobpackage0_.NOTE_TEXT_ID as NOTE_TE22_0_, jobpackage0_.LIBRARY_BOOK_VOLUMN as LIBRARY23_0_, jobpackage0_.ITAR_CONTENT_IND as ITAR_CO24_0_, jobpackage0_.COMR_CONTENT_IND as COMR_CO25_0_, jobpackage0_.EAR_CONTENT_IND as EAR_CON26_0_, jobpackage0_.MODEL_ID as MODEL_ID0_, jobpackage0_.REQUESTERS_DOCUMENT as REQUEST28_0_, jobpackage0_.JOB_PACKAGE_TYPE as JOB_PAC29_0_, jobpackage0_.WRITE_LOCKING_BEMS_ID as WRITE_L30_0_, jobpackage0_.WRITE_LOCKING_DATE as WRITE_L31_0_, jobpackage0_.OWNER_BEMS_ID as OWNER_B32_0_ from job_package jobpackage0_ where jobpackage0_.PACKAGE_ID=?
[8/10/05 17:28:18:528 PDT] 671a0820 SystemOut O Hibernate: select jobpackage0_.PACKAGE_ID as PACKAGE_ID0_, jobpackage0_.JOB_PACKAGE_NAME as JOB_PACK2_0_, jobpackage0_.SUBJECT as SUBJECT0_, jobpackage0_.ARCHIVE_DATE as ARCHIVE_4_0_, jobpackage0_.HISTORY as HISTORY0_, jobpackage0_.REVISION_LEVEL as REVISION6_0_, jobpackage0_.REVISION_NOTE as REVISION7_0_, jobpackage0_.SA_FOLDER_ID as SA_FOLDE8_0_, jobpackage0_.STATUS as STATUS0_, jobpackage0_.PROBLEM_FREQUENCY as PROBLEM10_0_, jobpackage0_.SIRP as SIRP0_, jobpackage0_.INITIATOR_BEMS_ID as INITIAT12_0_, jobpackage0_.PRIMARY_COMPONENT as PRIMARY13_0_, jobpackage0_.LIBRARY_LOCATION_CODE as LIBRARY14_0_, jobpackage0_.PUBLISHED_IND as PUBLISH15_0_, jobpackage0_.ANALYSIS_DESCRIPTION_TEXT_ID as ANALYSI16_0_, jobpackage0_.PRIMARY_DISCREPANCY_KEYWORD_ID as PRIMARY17_0_, jobpackage0_.ATA as ATA0_, jobpackage0_.CHARGEABLE_IND as CHARGEA19_0_, jobpackage0_.PROBLEM_TEXT_ID as PROBLEM20_0_, jobpackage0_.LIBRARY_LOCATION as LIBRARY21_0_, jobpackage0_.NOTE_TEXT_ID as NOTE_TE22_0_, jobpackage0_.LIBRARY_BOOK_VOLUMN as LIBRARY23_0_, jobpackage0_.ITAR_CONTENT_IND as ITAR_CO24_0_, jobpackage0_.COMR_CONTENT_IND as COMR_CO25_0_, jobpackage0_.EAR_CONTENT_IND as EAR_CON26_0_, jobpackage0_.MODEL_ID as MODEL_ID0_, jobpackage0_.REQUESTERS_DOCUMENT as REQUEST28_0_, jobpackage0_.JOB_PACKAGE_TYPE as JOB_PAC29_0_, jobpackage0_.WRITE_LOCKING_BEMS_ID as WRITE_L30_0_, jobpackage0_.WRITE_LOCKING_DATE as WRITE_L31_0_, jobpackage0_.OWNER_BEMS_ID as OWNER_B32_0_ from job_package jobpackage0_ where jobpackage0_.PACKAGE_ID=?
[8/10/05 17:28:18:543 PDT] 671a0820 SystemOut O Hibernate: select jobpackage0_.PACKAGE_ID as PACKAGE_ID0_, jobpackage0_.JOB_PACKAGE_NAME as JOB_PACK2_0_, jobpackage0_.SUBJECT as SUBJECT0_, jobpackage0_.ARCHIVE_DATE as ARCHIVE_4_0_, jobpackage0_.HISTORY as HISTORY0_, jobpackage0_.REVISION_LEVEL as REVISION6_0_, jobpackage0_.REVISION_NOTE as REVISION7_0_, jobpackage0_.SA_FOLDER_ID as SA_FOLDE8_0_, jobpackage0_.STATUS as STATUS0_, jobpackage0_.PROBLEM_FREQUENCY as PROBLEM10_0_, jobpackage0_.SIRP as SIRP0_, jobpackage0_.INITIATOR_BEMS_ID as INITIAT12_0_, jobpackage0_.PRIMARY_COMPONENT as PRIMARY13_0_, jobpackage0_.LIBRARY_LOCATION_CODE as LIBRARY14_0_, jobpackage0_.PUBLISHED_IND as PUBLISH15_0_, jobpackage0_.ANALYSIS_DESCRIPTION_TEXT_ID as ANALYSI16_0_, jobpackage0_.PRIMARY_DISCREPANCY_KEYWORD_ID as PRIMARY17_0_, jobpackage0_.ATA as ATA0_, jobpackage0_.CHARGEABLE_IND as CHARGEA19_0_, jobpackage0_.PROBLEM_TEXT_ID as PROBLEM20_0_, jobpackage0_.LIBRARY_LOCATION as LIBRARY21_0_, jobpackage0_.NOTE_TEXT_ID as NOTE_TE22_0_, jobpackage0_.LIBRARY_BOOK_VOLUMN as LIBRARY23_0_, jobpackage0_.ITAR_CONTENT_IND as ITAR_CO24_0_, jobpackage0_.COMR_CONTENT_IND as COMR_CO25_0_, jobpackage0_.EAR_CONTENT_IND as EAR_CON26_0_, jobpackage0_.MODEL_ID as MODEL_ID0_, jobpackage0_.REQUESTERS_DOCUMENT as REQUEST28_0_, jobpackage0_.JOB_PACKAGE_TYPE as JOB_PAC29_0_, jobpackage0_.WRITE_LOCKING_BEMS_ID as WRITE_L30_0_, jobpackage0_.WRITE_LOCKING_DATE as WRITE_L31_0_, jobpackage0_.OWNER_BEMS_ID as OWNER_B32_0_ from job_package jobpackage0_ where jobpackage0_.PACKAGE_ID=?
[8/10/05 17:28:18:559 PDT] 671a0820 SystemOut O Hibernate: select jobpackage0_.PACKAGE_ID as PACKAGE_ID0_, jobpackage0_.JOB_PACKAGE_NAME as JOB_PACK2_0_, jobpackage0_.SUBJECT as SUBJECT0_, jobpackage0_.ARCHIVE_DATE as ARCHIVE_4_0_, jobpackage0_.HISTORY as HISTORY0_, jobpackage0_.REVISION_LEVEL as REVISION6_0_, jobpackage0_.REVISION_NOTE as REVISION7_0_, jobpackage0_.SA_FOLDER_ID as SA_FOLDE8_0_, jobpackage0_.STATUS as STATUS0_, jobpackage0_.PROBLEM_FREQUENCY as PROBLEM10_0_, jobpackage0_.SIRP as SIRP0_, jobpackage0_.INITIATOR_BEMS_ID as INITIAT12_0_, jobpackage0_.PRIMARY_COMPONENT as PRIMARY13_0_, jobpackage0_.LIBRARY_LOCATION_CODE as LIBRARY14_0_, jobpackage0_.PUBLISHED_IND as PUBLISH15_0_, jobpackage0_.ANALYSIS_DESCRIPTION_TEXT_ID as ANALYSI16_0_, jobpackage0_.PRIMARY_DISCREPANCY_KEYWORD_ID as PRIMARY17_0_, jobpackage0_.ATA as ATA0_, jobpackage0_.CHARGEABLE_IND as CHARGEA19_0_, jobpackage0_.PROBLEM_TEXT_ID as PROBLEM20_0_, jobpackage0_.LIBRARY_LOCATION as LIBRARY21_0_, jobpackage0_.NOTE_TEXT_ID as NOTE_TE22_0_, jobpackage0_.LIBRARY_BOOK_VOLUMN as LIBRARY23_0_, jobpackage0_.ITAR_CONTENT_IND as ITAR_CO24_0_, jobpackage0_.COMR_CONTENT_IND as COMR_CO25_0_, jobpackage0_.EAR_CONTENT_IND as EAR_CON26_0_, jobpackage0_.MODEL_ID as MODEL_ID0_, jobpackage0_.REQUESTERS_DOCUMENT as REQUEST28_0_, jobpackage0_.JOB_PACKAGE_TYPE as JOB_PAC29_0_, jobpackage0_.WRITE_LOCKING_BEMS_ID as WRITE_L30_0_, jobpackage0_.WRITE_LOCKING_DATE as WRITE_L31_0_, jobpackage0_.OWNER_BEMS_ID as OWNER_B32_0_ from job_package jobpackage0_ where jobpackage0_.PACKAGE_ID=?
[8/10/05 17:28:18:590 PDT] 671a0820 SystemOut O Hibernate: select jobpackage0_.PACKAGE_ID as PACKAGE_ID0_, jobpackage0_.JOB_PACKAGE_NAME as JOB_PACK2_0_, jobpackage0_.SUBJECT as SUBJECT0_, jobpackage0_.ARCHIVE_DATE as ARCHIVE_4_0_, jobpackage0_.HISTORY as HISTORY0_, jobpackage0_.REVISION_LEVEL as REVISION6_0_, jobpackage0_.REVISION_NOTE as REVISION7_0_, jobpackage0_.SA_FOLDER_ID as SA_FOLDE8_0_, jobpackage0_.STATUS as STATUS0_, jobpackage0_.PROBLEM_FREQUENCY as PROBLEM10_0_, jobpackage0_.SIRP as SIRP0_, jobpackage0_.INITIATOR_BEMS_ID as INITIAT12_0_, jobpackage0_.PRIMARY_COMPONENT as PRIMARY13_0_, jobpackage0_.LIBRARY_LOCATION_CODE as LIBRARY14_0_, jobpackage0_.PUBLISHED_IND as PUBLISH15_0_, jobpackage0_.ANALYSIS_DESCRIPTION_TEXT_ID as ANALYSI16_0_, jobpackage0_.PRIMARY_DISCREPANCY_KEYWORD_ID as PRIMARY17_0_, jobpackage0_.ATA as ATA0_, jobpackage0_.CHARGEABLE_IND as CHARGEA19_0_, jobpackage0_.PROBLEM_TEXT_ID as PROBLEM20_0_, jobpackage0_.LIBRARY_LOCATION as LIBRARY21_0_, jobpackage0_.NOTE_TEXT_ID as NOTE_TE22_0_, jobpackage0_.LIBRARY_BOOK_VOLUMN as LIBRARY23_0_, jobpackage0_.ITAR_CONTENT_IND as ITAR_CO24_0_, jobpackage0_.COMR_CONTENT_IND as COMR_CO25_0_, jobpackage0_.EAR_CONTENT_IND as EAR_CON26_0_, jobpackage0_.MODEL_ID as MODEL_ID0_, jobpackage0_.REQUESTERS_DOCUMENT as REQUEST28_0_, jobpackage0_.JOB_PACKAGE_TYPE as JOB_PAC29_0_, jobpackage0_.WRITE_LOCKING_BEMS_ID as WRITE_L30_0_, jobpackage0_.WRITE_LOCKING_DATE as WRITE_L31_0_, jobpackage0_.OWNER_BEMS_ID as OWNER_B32_0_ from job_package jobpackage0_ where jobpackage0_.PACKAGE_ID=?
[8/10/05 17:28:18:621 PDT] 671a0820 SystemOut O xxxxxxxx Job List size():10
Debug level Hibernate log excerpt:
All