Hi,
I'm trying to get the value of the description field from a file status lookup table (cc_file_status_type_t.ccfile_stat_dsc) that is a foreign key to a file table via a code field (cc_file_t.ccfile_stat_cd = cc_file_status_type_t.ccfile_stat_cd).
I don't think the current code works, in the FileVO I have the following and the fileStatusDescription getter() method isn't being initialised (toString() displays as below)
FileVO:
/** gcli_id. */
private long gcliId;
/** pol_id. */
private int polId;
/** ccfile_seq_num. */
private int ccfileSeqNum;
/** ccfile_stat_cd. */
private String ccfileStatCd;
/** ccfile_rcvd_dtm. */
private Date ccfileRcvdDtm;
/** ccfile_mbr_cnt. */
private int ccfileMbrCnt;
/** ccfile_upld_user_nm. */
private String ccfileUpldUserNm;
/** ccfile_rcvd_nm. */
private String ccfileRcvdNm;
/** ccfile_asgn_nm. */
private String ccfileAsgnNm;
/** ccfile_mb_size_num. */
private int ccfileMbSizeNum;
/** ccfile_mbr_rjct_num. */
private int ccfileMbrRjctNum;
/** ccfile_10pct_chg_ind. */
private String ccfile10pctChgInd;
/** ccfile_create_dt. */
private Date ccfileCreateDt;
/** lst_upd_dtm. */
private Date lstUpdDtm;
/** lst_upd_user_id. */
private String lstUpdUserId;
private FileStatusTypeVO fileStatusDescription;
public FileStatusTypeVO getFileStatusDescription() {
return fileStatusDescription;
}
public void setFileStatusDescription(
FileStatusTypeVO fileStatusDescriptionIn) {
fileStatusDescription = fileStatusDescriptionIn;
}
...etc
public final String toString() {
final StringBuffer ret = new StringBuffer();
ret.append("FileVO: ");
ret.append("gcliId='" + this.gcliId + "'");
ret.append(", polId='" + this.polId + "'");
ret.append(", ccfileSeqNum='" + this.ccfileSeqNum + "'");
ret.append(", ccfileStatCd='" + this.ccfileStatCd + "'");
ret.append(", ccfileRcvdDtm='" + this.ccfileRcvdDtm + "'");
ret.append(", ccfileMbrCnt='" + this.ccfileMbrCnt + "'");
ret.append(", ccfileUpldUserNm='" + this.ccfileUpldUserNm + "'");
ret.append(", ccfileRcvdNm='" + this.ccfileRcvdNm + "'");
ret.append(", ccfileAsgnNm='" + this.ccfileAsgnNm + "'");
ret.append(", ccfileMbSizeNum='" + this.ccfileMbSizeNum + "'");
ret.append(", ccfileMbrRjctNum='" + this.ccfileMbrRjctNum + "'");
ret.append(", ccfile10pctChgInd='" + this.ccfile10pctChgInd + "'");
ret.append(", ccfileCreateDt='" + this.ccfileCreateDt + "'");
ret.append(", lstUpdDtm='" + this.lstUpdDtm + "'");
ret.append(", lstUpdUserId='" + this.lstUpdUserId + "'");
if (fileStatusDescription != null) {
ret.append(", fileStatusDescription='" + this.fileStatusDescription.toString() + "'");
} else {
ret.append(", fileStatusDescription='NULL'");
}
return ret.toString();
}
Hibernate version: 3.2
Mapping documents:
File:
<hibernate-mapping>
<class name="FileVO" table="cc_file_t">
<composite-id>
<key-property name="gcliId" column="gcli_id" />
<key-property name="polId" column="pol_id" />
<key-property name="ccfileSeqNum" column="ccfile_seq_num" />
</composite-id>
<property name="ccfileStatCd" column="ccfile_stat_cd" type="TrimmedString" />
<property name="ccfileRcvdDtm" column="ccfile_rcvd_dtm" />
<property name="ccfileMbrCnt" column="ccfile_mbr_cnt" />
<property name="ccfileUpldUserNm" column="ccfile_upld_user_nm" />
<property name="ccfileRcvdNm" column="ccfile_rcvd_nm" />
<property name="ccfileAsgnNm" column="ccfile_asgn_nm" />
<property name="ccfileMbSizeNum" column="ccfile_mb_size_num" />
<property name="ccfileMbrRjctNum" column="ccfile_mbr_rjct_num" />
<property name="ccfile10pctChgInd" column="ccfile_10pct_chg_ind" />
<property name="ccfileCreateDt" column="ccfile_create_dt" />
<property name="lstUpdDtm" column="lst_upd_dtm" />
<property name="lstUpdUserId" column="lst_upd_user_id" />
<many-to-one name="fileStatusDescription" class="FileStatusTypeVO" column="ccfile_stat_cd" insert="false" update="false" />
</class>
</hibernate-mapping>
FileStatusType:
<hibernate-mapping>
<class name="FileStatusTypeVO" table="cc_file_status_type_t">
<id name="code" column="ccfile_stat_cd" type="TrimmedString" />
<property name="desc" column="ccfile_stat_dsc" not-null="true" />
<property name="lstUpdDtm" column="lst_upd_dtm" not-null="true" />
<property name="lstUpdUserId" column="lst_upd_user_id" not-null="true" />
</class>
</hibernate-mapping>
Has anyone any suggestions ?
While on the subject, are there ANY good hibernate reference books?
|