-->
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: Foreign key value returns null in many-to-one association
PostPosted: Wed Aug 10, 2005 8:42 pm 
Newbie

Joined: Mon Aug 08, 2005 8:29 pm
Posts: 10
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 1:26 am 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
I'm not entirely clear on what you're seeing as null, and I've never used Hibernate 2.x before. However, why do you have outer-join="true" set in your many-to-one mapping? That looks like a potential cause for having some values show up as null.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 12:53 pm 
Newbie

Joined: Mon Aug 08, 2005 8:29 pm
Posts: 10
Thank you for your reply.

I hope this will explain better:

I'm fetching all the jobs from 'Job' table where "package_id" is the foreign key in 'Job' table and is the primary key for 'job_package' table. It means many jobs are associated with one or more 'jobPackage'.

Evenif I remove "outer-join=true" from "many-to-one" mapping, i'm still gettting "package_id" value null for all 'Jobs' though each job has package_id value in the table. I get all the values for all the jobs except 'package_id'.

Here is the pojo:
-----------------------------
jobs.java
-----------

public class Jobs implements Serializable{

private Integer jobId;
private Integer packageId;
private String jobName;
private Date timeDateOut;
private Date jobDateDue;
private Date jobDateIn;
private Date jobDateLoggedIn;
private Date jobExtendedDateDue;
private Integer jobPriority;
private String jobSpecificQuestion;
private String jobStatus;
private String jobSubject;
private String jobType;
private String requester;
private Integer requesterBemsId;
private String dispSummary;
private Integer assigneeBemsId;
private Integer assigneeClearInd;
private Integer assigneeNewInd;
private Integer initiatorBemsId;
private Integer initiatorClearInd;
private Integer initiatorNewInd;
private Integer noteTextId;
private Integer approverBemsId;
private Integer approverNewInd;
private Integer approverClearInd;

/** nullable persistent field */
private JobPackage jobPackage;

//full constructor
public Jobs(
Integer jobId,
Integer packageId,
String jobName,
Date timeDateOut,
Date jobDateDue,
Date jobDateIn,
Date jobDateLoggedIn,
Date jobExtendedDateDue,
Integer jobPriority,
String jobSpecificQuestion,
String jobStatus,
String jobSubject,
String jobType,
String requester,
Integer requesterBemsId,
String dispSummary,
Integer assigneeBemsId,
Integer assigneeClearInd,
Integer assigneeNewInd,
Integer initiatorBemsId,
Integer initiatorClearInd,
Integer initiatorNewInd,
Integer noteTextId,
Integer approverBemsId,
Integer approverNewInd,
Integer approverClearInd,
JobPackage jobPackage){

this.jobId = jobId;
this.packageId = packageId;
this.jobName = jobName;
this.timeDateOut = timeDateOut;
this.jobDateDue = jobDateDue;
this.jobDateIn = jobDateIn;
this.jobDateLoggedIn = jobDateLoggedIn;
this.jobExtendedDateDue= jobExtendedDateDue;
this.jobPriority = jobPriority;
this.jobSpecificQuestion = jobSpecificQuestion;
this.jobStatus = jobStatus;
this.jobSubject = jobSubject;
this.jobType = jobType;
this.requester = requester;
this.requesterBemsId = requesterBemsId;
this.dispSummary = dispSummary;
this.assigneeBemsId = assigneeBemsId;
this.assigneeClearInd = assigneeClearInd;
this.assigneeNewInd = assigneeNewInd;
this.initiatorBemsId = initiatorBemsId;
this.initiatorClearInd = initiatorClearInd;
this.initiatorNewInd = initiatorNewInd;
this.noteTextId = noteTextId;
this.approverBemsId = approverBemsId;
this.approverNewInd = approverNewInd;
this.approverClearInd = approverClearInd;
this.jobPackage = jobPackage;
}

/** default constructor */
public Jobs() {
}

//minimal constructor
public Jobs(JobPackage jobPackage){
setJobPackage(jobPackage);
}


/**
* @return
*/
public Integer getApproverBemsId() {
return this.approverBemsId;
}

/**
* @return
*/
public Integer getApproverClearInd() {
return this.approverClearInd;
}

/**
* @return
*/
public Integer getApproverNewInd() {
return this.approverNewInd;
}

/**
* @return
*/
public Integer getAssigneeBemsId() {
return this.assigneeBemsId;
}

/**
* @return
*/
public Integer getAssigneeClearInd() {
return this.assigneeClearInd;
}

/**
* @return
*/
public Integer getAssigneeNewInd() {
return this.assigneeNewInd;
}

/**
* @return
*/
public String getDispSummary() {
return this.dispSummary;
}

/**
* @return
*/
public Integer getInitiatorBemsId() {
return this.initiatorBemsId;
}

/**
* @return
*/
public Integer getInitiatorClearInd() {
return this.initiatorClearInd;
}

/**
* @return
*/
public Integer getInitiatorNewInd() {
return this.initiatorNewInd;
}

/**
* @return
*/
public Date getJobDateDue() {
return this.jobDateDue;
}

/**
* @return
*/
public Date getJobDateIn() {
return this.jobDateIn;
}

/**
* @return
*/
public Date getJobDateLoggedIn() {
return this.jobDateLoggedIn;
}

/**
* @return
*/
public Date getJobExtendedDateDue() {
return this.jobExtendedDateDue;
}

/**
* @return
*/
public Integer getJobId() {
return this.jobId;
}

/**
* @return
*/
public String getJobName() {
return this.jobName;
}

/**
* @return
*/
public JobPackage getJobPackage() {
return this.jobPackage;
}

/**
* @return
*/
public Integer getJobPriority() {
return this.jobPriority;
}

/**
* @return
*/
public String getJobSpecificQuestion() {
return this.jobSpecificQuestion;
}

/**
* @return
*/
public String getJobStatus() {
return this.jobStatus;
}

/**
* @return
*/
public String getJobSubject() {
return this.jobSubject;
}

/**
* @return
*/
public String getJobType() {
return this.jobType;
}

/**
* @return
*/
public Integer getNoteTextId() {
return this.noteTextId;
}

/**
* @return
*/
public Integer getPackageId() {
return this.packageId;
}

/**
* @return
*/
public String getRequester() {
return this.requester;
}

/**
* @return
*/
public Integer getRequesterBemsId() {
return this.requesterBemsId;
}

/**
* @return
*/
public Date getTimeDateOut() {
return this.timeDateOut;
}

/**
* @param i
*/
public void setApproverBemsId(Integer i) {
this.approverBemsId = i;
}

/**
* @param i
*/
public void setApproverClearInd(Integer i) {
this.approverClearInd = i;
}

/**
* @param i
*/
public void setApproverNewInd(Integer i) {
this.approverNewInd = i;
}

/**
* @param i
*/
public void setAssigneeBemsId(Integer i) {
this.assigneeBemsId = i;
}

/**
* @param i
*/
public void setAssigneeClearInd(Integer i) {
this.assigneeClearInd = i;
}

/**
* @param i
*/
public void setAssigneeNewInd(Integer i) {
this.assigneeNewInd = i;
}

/**
* @param string
*/
public void setDispSummary(String string) {
this.dispSummary = string;
}

/**
* @param i
*/
public void setInitiatorBemsId(Integer i) {
this.initiatorBemsId = i;
}

/**
* @param i
*/
public void setInitiatorClearInd(Integer i) {
this.initiatorClearInd = i;
}

/**
* @param i
*/
public void setInitiatorNewInd(Integer i) {
this.initiatorNewInd = i;
}

/**
* @param date
*/
public void setJobDateDue(Date date) {
this.jobDateDue = date;
}

/**
* @param date
*/
public void setJobDateIn(Date date) {
this.jobDateIn = date;
}

/**
* @param date
*/
public void setJobDateLoggedIn(Date date) {
this.jobDateLoggedIn = date;
}

/**
* @param date
*/
public void setJobExtendedDateDue(Date date) {
this.jobExtendedDateDue = date;
}

/**
* @param i
*/
public void setJobId(Integer i) {
this.jobId = i;
}

/**
* @param string
*/
public void setJobName(String string) {
this.jobName = string;
}

/**
* @param package1
*/
public void setJobPackage(JobPackage package1) {
this.jobPackage = package1;
}

/**
* @param i
*/
public void setJobPriority(Integer i) {
this.jobPriority = i;
}

/**
* @param string
*/
public void setJobSpecificQuestion(String string) {
this.jobSpecificQuestion = string;
}

/**
* @param string
*/
public void setJobStatus(String string) {
this.jobStatus = string;
}

/**
* @param string
*/
public void setJobSubject(String string) {
this.jobSubject = string;
}

/**
* @param string
*/
public void setJobType(String string) {
this.jobType = string;
}

/**
* @param i
*/
public void setNoteTextId(Integer i) {
this.noteTextId = i;
}

/**
* @param i
*/
public void setPackageId(Integer i) {
this.packageId = i;
}

/**
* @param string
*/
public void setRequester(String string) {
this.requester = string;
}

/**
* @param i
*/
public void setRequesterBemsId(Integer i) {
this.requesterBemsId = i;
}

/**
* @param date
*/
public void setTimeDateOut(Date date) {
this.timeDateOut = date;
}

}
------------------------------------------------------------------------------
JobPackage.java
-------------------

public class JobPackage implements Serializable{

private Integer packageId;
private String jobPackageName;
private String subject;
private Date archiveDate;
private String history;
private Integer revisionLevel;
private String revisionNote;
private Integer saFolderId;
private String status;
private String problemFrequency;
private String sirp;
private Integer initiatorBemsId;
private String primaryComponent;
private String libraryLocationCode;
private Integer publishedInd;
private Integer analysisDescriptionTextId;
private Integer primaryDiscrepancyKeywordId;
private char ata;
private Integer chargeableInd;
private Integer problemTextId;
private String libraryLocation;
private Integer noteTextId;
private String libraryBookVolumn;
private Integer itarContentInd;
private Integer comrContentInd;
private Integer earContentInd;
private Integer modelId;
private String requestersDocument;
private String jobPackageType;
private Integer writeLockingBemsId;
private Date writeLockingDate;
private Integer ownerBemsId;

/** persistent field */
private Set jobs;

//full constructor
public JobPackage(
Integer packageId,
String jobPackageName,
String subject,
Date archiveDate,
String history,
Integer revisionLevel,
String revisionNote,
Integer saFolderId,
String status,
String problemFrequency,
String sirp,
Integer initiatorBemsId,
String primaryComponent,
String libraryLocationCode,
Integer publishedInd,
Integer analysisDescriptionTextId,
Integer primaryDiscrepancyKeywordId,
char ata,
Integer chargeableInd,
Integer problemTextId,
String libraryLocation,
Integer noteTextId,
String libraryBookVolumn,
Integer itarContentInd,
Integer comrContentInd,
Integer earContentInd,
Integer modelId,
String requestersDocument,
String jobPackageType,
Integer writeLockingBemsId,
Date writeLockingDate,
Integer ownerBemsId,
Set jobs){

this.packageId= packageId;
this.jobPackageName= jobPackageName;
this.subject= subject;
this.archiveDate= archiveDate;
this.history= history;
this.revisionLevel= revisionLevel;
this.revisionNote= revisionNote;
this.saFolderId= saFolderId;
this.status= status;
this.problemFrequency= problemFrequency;
this.sirp= sirp;
this.initiatorBemsId= initiatorBemsId;
this.primaryComponent= primaryComponent;
this.libraryLocationCode= libraryLocationCode;
this.publishedInd= publishedInd;
this.analysisDescriptionTextId= analysisDescriptionTextId;
this.primaryDiscrepancyKeywordId= primaryDiscrepancyKeywordId;
this.ata= ata;
this.chargeableInd= chargeableInd;
this.problemTextId= problemTextId;
this.libraryLocation= libraryLocation;
this.noteTextId= noteTextId;
this.libraryBookVolumn= libraryBookVolumn;
this.itarContentInd= itarContentInd;
this.comrContentInd= comrContentInd;
this.earContentInd= earContentInd;
this.modelId= modelId;
this.requestersDocument= requestersDocument;
this.jobPackageType= jobPackageType;
this.writeLockingBemsId= writeLockingBemsId;
this.writeLockingDate= writeLockingDate;
this.ownerBemsId= ownerBemsId;
this.jobs = jobs;

}


/** default constructor */
public JobPackage() {
}

/** minimal constructor */
public JobPackage(Set jobs) {
this.jobs = jobs;
}


/**
* @return
*/
public Integer getAnalysisDescriptionTextId() {
return analysisDescriptionTextId;
}

/**
* @return
*/
public Date getArchiveDate() {
return archiveDate;
}

/**
* @return
*/
public char getAta() {
return ata;
}

/**
* @return
*/
public Integer getChargeableInd() {
return chargeableInd;
}

/**
* @return
*/
public Integer getComrContentInd() {
return comrContentInd;
}

/**
* @return
*/
public Integer getEarContentInd() {
return earContentInd;
}

/**
* @return
*/
public String getHistory() {
return history;
}

/**
* @return
*/
public Integer getInitiatorBemsId() {
return initiatorBemsId;
}

/**
* @return
*/
public Integer getItarContentInd() {
return itarContentInd;
}

/**
* @return
*/
public String getJobPackageName() {
return jobPackageName;
}

/**
* @return
*/
public String getJobPackageType() {
return jobPackageType;
}

/**
* @return
*/
public String getLibraryBookVolumn() {
return libraryBookVolumn;
}

/**
* @return
*/
public String getLibraryLocation() {
return libraryLocation;
}

/**
* @return
*/
public String getLibraryLocationCode() {
return libraryLocationCode;
}

/**
* @return
*/
public Integer getModelId() {
return modelId;
}

/**
* @return
*/
public Integer getNoteTextId() {
return noteTextId;
}

/**
* @return
*/
public Integer getOwnerBemsId() {
return ownerBemsId;
}

/**
* @return
*/
public Integer getPackageId() {
return packageId;
}

/**
* @return
*/
public String getPrimaryComponent() {
return primaryComponent;
}

/**
* @return
*/
public Integer getPrimaryDiscrepancyKeywordId() {
return primaryDiscrepancyKeywordId;
}

/**
* @return
*/
public String getProblemFrequency() {
return problemFrequency;
}

/**
* @return
*/
public Integer getProblemTextId() {
return problemTextId;
}

/**
* @return
*/
public Integer getPublishedInd() {
return publishedInd;
}

/**
* @return
*/
public String getRequestersDocument() {
return requestersDocument;
}

/**
* @return
*/
public Integer getRevisionLevel() {
return this.revisionLevel;
}

/**
* @return
*/
public String getRevisionNote() {
return revisionNote;
}

/**
* @return
*/
public Integer getSaFolderId() {
return saFolderId;
}

/**
* @return
*/
public String getSirp() {
return sirp;
}

/**
* @return
*/
public String getStatus() {
return status;
}

/**
* @return
*/
public String getSubject() {
return subject;
}

/**
* @return
*/
public Integer getWriteLockingBemsId() {
return writeLockingBemsId;
}

/**
* @return
*/
public Date getWriteLockingDate() {
return writeLockingDate;
}

/**
* @param i
*/
public void setAnalysisDescriptionTextId(Integer i) {
this.analysisDescriptionTextId = i;
}

/**
* @param string
*/
public void setArchiveDate(Date dte) {
this.archiveDate = dte;
}

/**
* @param c
*/
public void setAta(char c) {
this.ata = c;
}

/**
* @param i
*/
public void setChargeableInd(Integer i) {
this.chargeableInd = i;
}

/**
* @param i
*/
public void setComrContentInd(Integer i) {
this.comrContentInd = i;
}

/**
* @param i
*/
public void setEarContentInd(Integer i) {
this.earContentInd = i;
}

/**
* @param string
*/
public void setHistory(String string) {
this.history = string;
}

/**
* @param i
*/
public void setInitiatorBemsId(Integer i) {
this.initiatorBemsId = i;
}

/**
* @param i
*/
public void setItarContentInd(Integer i) {
this.itarContentInd = i;
}

/**
* @param string
*/
public void setJobPackageName(String string) {
this.jobPackageName = string;
}

/**
* @param string
*/
public void setJobPackageType(String string) {
this.jobPackageType = string;
}

/**
* @param string
*/
public void setLibraryBookVolumn(String string) {
this.libraryBookVolumn = string;
}

/**
* @param string
*/
public void setLibraryLocation(String string) {
this.libraryLocation = string;
}

/**
* @param string
*/
public void setLibraryLocationCode(String string) {
this.libraryLocationCode = string;
}

/**
* @param i
*/
public void setModelId(Integer i) {
this.modelId = i;
}

/**
* @param i
*/
public void setNoteTextId(Integer i) {
this.noteTextId = i;
}

/**
* @param i
*/
public void setOwnerBemsId(Integer i) {
this.ownerBemsId = i;
}

/**
* @param i
*/
public void setPackageId(Integer i) {
this.packageId = i;
}

/**
* @param string
*/
public void setPrimaryComponent(String string) {
this.primaryComponent = string;
}

/**
* @param i
*/
public void setPrimaryDiscrepancyKeywordId(Integer i) {
this.primaryDiscrepancyKeywordId = i;
}

/**
* @param string
*/
public void setProblemFrequency(String string) {
this.problemFrequency = string;
}

/**
* @param i
*/
public void setProblemTextId(Integer i) {
this.problemTextId = i;
}

/**
* @param i
*/
public void setPublishedInd(Integer i) {
this.publishedInd = i;
}

/**
* @param string
*/
public void setRequestersDocument(String string) {
this.requestersDocument = string;
}

/**
* @param i
*/
public void setRevisionLevel(Integer i) {
this.revisionLevel = i;
}

/**
* @param string
*/
public void setRevisionNote(String string) {
this.revisionNote = string;
}

/**
* @param i
*/
public void setSaFolderId(Integer i) {
this.saFolderId = i;
}

/**
* @param string
*/
public void setSirp(String string) {
this.sirp = string;
}

/**
* @param string
*/
public void setStatus(String string) {
this.status = string;
}

/**
* @param string
*/
public void setSubject(String string) {
this.subject = string;
}

/**
* @param i
*/
public void setWriteLockingBemsId(Integer i) {
this.writeLockingBemsId = i;
}

/**
* @param string
*/
public void setWriteLockingDate(Date dte) {
this.writeLockingDate = dte;
}

/**
* @return
*/
public Set getJobs() {
return jobs;
}

/**
* @param set
*/
public void setJobs(Set set) {
this.jobs = set;
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 4:37 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
package id looks like it's commented out in your mapping

<!--<property name="packageId" column="PACKAGE_ID"/>-->

uncomment it...

<property name="packageId" column="PACKAGE_ID"/>

otherwise hibernate doesn't know it's a persistent property


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 7:50 pm 
Newbie

Joined: Mon Aug 08, 2005 8:29 pm
Posts: 10
That property is set in

<many-to-one name="jobPackage"
column="PACKAGE_ID"
class="com.boeing.tsas.castle.data.transferobjects.JobPackage"

If I uncomment it, it complains about repeated/duplicate column entry.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 8:22 pm 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Have you already tried to take another column name for "PACKAGE_ID"? "PACKAGE" is a key word in Oracle. I think it's unlikely, but there might be a problem...

Best regards
Sven


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 8:56 pm 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
Your jobPackage field isn't null though, right? You should be able to get your ID via "getJobPackage().getPackageId()". You mapped the JobPackage object to be a part of your Job class. The packageID is part of the JobPackage, not the Job.

If your jobPackage itself is null, then we've got other problems.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 1:01 am 
Newbie

Joined: Mon Aug 08, 2005 8:29 pm
Posts: 10
jdl,
Thank you. Your reply helped me resolve the issue.

Thanks all for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 6:04 pm 
Newbie

Joined: Mon Aug 08, 2005 8:29 pm
Posts: 10
How can I delete the records from Job or JobPackage table?

I'm trying to delete a record from Job table, I get the following error message. I understand the error but don't know what to do.

Exception creating sessionfactory: not-null property references a null or transient value: com.boeing.tsas.castle.data.transferobjects.Jobs.jobPackage.

Here is the code which is deleting the record in job table.

hibernateSession = HibernateSessionFactory.currentSession();
tx = hibernateSession.beginTransaction();

job.setJobId(Integer.valueOf("11"));
hibernateSession.delete(job);

tx.commit();
hibernateSession.close();

Also when a delete a record from Job_Package table similar way, i get some violation error stating child record exists.

Your thoughts would be greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 2:16 am 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
ssayyad wrote:
job.setJobId(Integer.valueOf("11"));
hibernateSession.delete(job);


Code:
job = (Job) hibernateSession.get(Job.class, new Integer(11));
session.delete(job);


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 4:27 pm 
Newbie

Joined: Mon Aug 08, 2005 8:29 pm
Posts: 10
Thanks for the help.

This works well if I delete all dependent records from the child (Job) table and then delete the record from the parent (Job_Package) table.

I have records in Job(child) table which has the reference (foreign key) to Job_Package table. I also have "inverse=false" in parent class's property file(JobPackage.hbm.xml).

How can I delete the record from the parent(Job_Package) table and that will also delete all dependent records from the child tables?

Please help me with sample code and URLs where I can get help.

Thank you.


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.