-->
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.  [ 2 posts ] 
Author Message
 Post subject: net.sf.hibernate.HibernateException: unmapped property
PostPosted: Mon May 03, 2004 2:56 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 2:18 pm
Posts: 20
Here is the code between opensession and closesession:

public void updatePatientHistory(CaseStudyPatientHistory ph)
throws PETCTTutorXAException, RemoteException
{
try {
Session session = HibernateUtil.currentSession();
session.save(ph);
session.flush();
HibernateUtil.closeSession();
} catch (HibernateException e) {
e.printStackTrace();
throw new PETCTTutorXAException("Unable to create case study");
}
}

The code for CaseStudyPatientHistory:

public class CaseStudyPatientHistory implements Serializable {

/** Directly maps to the CaseStudyPatientHistoryId column in CASESTUDY_PATIENTHISTORY table*/
private long caseStudyPatientHistoryId;

/** Directly maps to the CaseStudyId column in CASESTUDY_PATIENTHISTORY table*/
private CaseStudyGeneral caseStudy;
private long caseStudyId;

/** Directly maps to the PatientHistoryHPI column in CASESTUDY_PATIENTHISTORY table*/
private String patientHistoryHPI;

/** Directly maps to the PatientHistoryPastMedical column in CASESTUDY_PATIENTHISTORY table*/
private String patientHistoryPastMedical;

/** Directly maps to the PatientHistoryMedications column in CASESTUDY_PATIENTHISTORY table*/
private String patientHistoryMedications;

/** Directly maps to the PatientHistoryImage1 column in CASESTUDY_PATIENTHISTORY table*/
private String patientHistoryImage1;

/** Directly maps to the PatientHistoryImage2 column in CASESTUDY_PATIENTHISTORY table*/
private String patientHistoryImage2;

/** Directly maps to the PatientHistoryImage3 column in CASESTUDY_PATIENTHISTORY table*/
private String patientHistoryImage3;

/** Directly maps to the PatientHistoryImagePosition column in CASESTUDY_PATIENTHISTORY table*/
private String patientHistoryImagePosition;



/**
* Get caseStudyPatientHistoryId
* @return long
*/
public long getCaseStudyPatientHistoryId() {
return caseStudyPatientHistoryId;
}

/**
* Get patientHistoryHPI
* @return String
*/
public String getPatientHistoryHPI() {
return patientHistoryHPI;
}

/**
* Get patientHistoryImage1
* @return String
*/
public String getPatientHistoryImage1() {
return patientHistoryImage1;
}

/**
* Get patientHistoryImage2
* @return String
*/
public String getPatientHistoryImage2() {
return patientHistoryImage2;
}

/**
* Get patientHistoryImage3
* @return String
*/
public String getPatientHistoryImage3() {
return patientHistoryImage3;
}

/**
* Get patientHistoryImagePosition
* @return String
*/
public String getPatientHistoryImagePosition() {
return patientHistoryImagePosition;
}

/**
* Get patientHistoryMedications
* @return String
*/
public String getPatientHistoryMedications() {
return patientHistoryMedications;
}

/**
* Get patientHistoryPastMedical
* @return String
*/
public String getPatientHistoryPastMedical() {
return patientHistoryPastMedical;
}


/**
* Set caseStudyPatientHistoryId
* @param l
*/
public void setCaseStudyPatientHistoryId(long l) {
caseStudyPatientHistoryId = l;
}

/**
* Set patientHistoryHPI
* @param string
*/
public void setPatientHistoryHPI(String string) {
patientHistoryHPI = string;
}

/**
* Set patientHistoryImage1
* @param string
*/
public void setPatientHistoryImage1(String string) {
patientHistoryImage1 = string;
}

/**
* Set patientHistoryImage2
* @param string
*/
public void setPatientHistoryImage2(String string) {
patientHistoryImage2 = string;
}

/**
* Set patientHistoryImage3
* @param string
*/
public void setPatientHistoryImage3(String string) {
patientHistoryImage3 = string;
}

/**
* Set patientHistoryImagePosition
* @param string
*/
public void setPatientHistoryImagePosition(String string) {
patientHistoryImagePosition = string;
}

/**
* Set patientHistoryMedications
* @param string
*/
public void setPatientHistoryMedications(String string) {
patientHistoryMedications = string;
}

/**
* Set patientHistoryPastMedical
* @param string
*/
public void setPatientHistoryPastMedical(String string) {
patientHistoryPastMedical = string;
}

/**
* @return
*/
public CaseStudyGeneral getCaseStudy() {
return caseStudy;
}

/**
* @param general
*/
public void setCaseStudy(CaseStudyGeneral general) {
caseStudy = general;
}

/**
* @return
*/
public long getCaseStudyId() {
return caseStudyId;
}

/**
* @param l
*/
public void setCaseStudyId(long l) {
caseStudyId = l;
}

}

The code for CaseStudyGeneral:

public class CaseStudyGeneral implements Serializable {


/** Directly maps to the CaseStudyID column in CASESTUDY_GENERAL table*/
private long caseStudyId;

/** Directly maps to the CaseName column in CASESTUDY_GENERAL table*/
private String caseName;

/** Directly maps to the CaseDescription column in CASESTUDY_GENERAL table*/
private String caseDescription;

/** Directly maps to the InternalCaseId column in CASESTUDY_GENERAL table*/
private String internalCaseId;

/** Directly maps to the DiseaseState column in CASESTUDY_GENERAL table*/
private String diseaseState;

/** Directly maps to the AudienceType column in CASESTUDY_GENERAL table*/
private String audienceType;

/** Directly maps to the Audience column in CASESTUDY_GENERAL table*/
private String audience;

/** Directly maps to the AccessType column in CASESTUDY_GENERAL table*/
private String accessType;

/** Directly maps to the FacilityId column in CASESTUDY_GENERAL table*/
private String facilityId;

/** Directly maps to the CaseOfMonth column in CASESTUDY_GENERAL table*/
private String caseOfMonth;

/** Directly maps to the CaseOfMonthAccessType column in CASESTUDY_GENERAL table*/
private String caseOfMonthAccessType;

/** Directly maps to the DateCreated column in CASESTUDY_GENERAL table*/
private Date dateCreated;

/** Directly maps to the CreateBy column in CASESTUDY_GENERAL table*/
private String createdBy;

/** Directly maps to the ReviewStatus column in CASESTUDY_GENERAL table*/
private String reviewStatus;

/** Directly maps to the ReviewBy column in CASESTUDY_GENERAL table*/
private String reviewedBy;

/** Directly maps to the ReviewDate column in CASESTUDY_GENERAL table*/
private Date reviewDate;

/** Directly maps to the DateModified column in CASESTUDY_GENERAL table*/
private Date dateModified;

/** Directly maps to the ModifiedBy column in CASESTUDY_GENERAL table*/
private String modifiedBy;

/** Directly maps to the ReferenceInfo column in CASESTUDY_GENERAL table*/
private String referenceInfo;

private Set findings;

private Set followups;

private Set pathologies;

private Set results;

private CaseStudyPatientHistory patientHistory;


/**
* Get accessType
* @return String
*/
public String getAccessType() {
return accessType;
}

/**
* Get audience
* @return String
*/
public String getAudience() {
return audience;
}

/**
* Get audienceType
* @return String
*/
public String getAudienceType() {
return audienceType;
}

/**
* Get caseDescription
* @return String
*/
public String getCaseDescription() {
return caseDescription;
}

/**
* Get caseName
* @return String
*/
public String getCaseName() {
return caseName;
}

/**
* Get caseOfMonth
* @return String
*/
public String getCaseOfMonth() {
return caseOfMonth;
}

/**
* Get caseOfMonthAccessType
* @return String
*/
public String getCaseOfMonthAccessType() {
return caseOfMonthAccessType;
}

/**
* Get caseStudyId
* @return long
*/
public long getCaseStudyId() {
return caseStudyId;
}

/**
* Get createBy
* @return String
*/
public String getCreatedBy() {
return createdBy;
}

/**
* Get dateCreated
* @return Date
*/
public Date getDateCreated() {
return dateCreated;
}

/**
* Get dateModified
* @return Date
*/
public Date getDateModified() {
return dateModified;
}

/**
* Get diseaseState
* @return String
*/
public String getDiseaseState() {
return diseaseState;
}

/**
* Get facilityId
* @return String
*/
public String getFacilityId() {
return facilityId;
}

/**
* Get internalCaseId
* @return String
*/
public String getInternalCaseId() {
return internalCaseId;
}

/**
* Get modifiedBy
* @return String
*/
public String getModifiedBy() {
return modifiedBy;
}

/**
* Get referenceInfo
* @return String
*/
public String getReferenceInfo() {
return referenceInfo;
}

/**
* Get reviewBy
* @return String
*/
public String getReviewedBy() {
return reviewedBy;
}

/**
* Get reviewDate
* @return Date
*/
public Date getReviewDate() {
return reviewDate;
}

/**
* Get reviewStatus
* @return String
*/
public String getReviewStatus() {
return reviewStatus;
}

/**
* Set accessType
* @param string
*/
public void setAccessType(String string) {
accessType = string;
}

/**
* Set audience
* @param string
*/
public void setAudience(String string) {
audience = string;
}

/**
* Set audienceType
* @param string
*/
public void setAudienceType(String string) {
audienceType = string;
}

/**
* Set caseDescription
* @param string
*/
public void setCaseDescription(String string) {
caseDescription = string;
}

/**
* Set caseName
* @param string
*/
public void setCaseName(String string) {
caseName = string;
}

/**
* Set caseOfMonth
* @param string
*/
public void setCaseOfMonth(String string) {
caseOfMonth = string;
}

/**
* Set caseOfMonthAccessType
* @param string
*/
public void setCaseOfMonthAccessType(String string) {
caseOfMonthAccessType = string;
}

/**
* Set caseStudyId
* @param l
*/
public void setCaseStudyId(long l) {
caseStudyId = l;
}

/**
* Set createdBy
* @param string
*/
public void setCreatedBy(String string) {
createdBy = string;
}

/**
* Set dateCreated
* @param date
*/
public void setDateCreated(Date date) {
dateCreated = date;
}

/**
* Set dateModified
* @param date
*/
public void setDateModified(Date date) {
dateModified = date;
}

/**
* Set diseaseState
* @param string
*/
public void setDiseaseState(String string) {
diseaseState = string;
}

/**
* Set facilityId
* @param string
*/
public void setFacilityId(String string) {
facilityId = string;
}

/**
* Set internalCaseId
* @param string
*/
public void setInternalCaseId(String string) {
internalCaseId = string;
}

/**
* Set modifiedBy
* @param string
*/
public void setModifiedBy(String string) {
modifiedBy = string;
}

/**
* Set referenceInfo
* @param string
*/
public void setReferenceInfo(String string) {
referenceInfo = string;
}

/**
* Set reviewBy
* @param string
*/
public void setReviewedBy(String string) {
reviewedBy = string;
}

/**
* Set reviewDate
* @param date
*/
public void setReviewDate(Date date) {
reviewDate = date;
}

/**
* Set reviewStatus
* @param string
*/
public void setReviewStatus(String string) {
reviewStatus = string;
}

/**
* @return
*/
public Set getFollowups() {
return followups;
}

/**
* @param set
*/
public void setFollowups(Set set) {
followups = set;
}

public void addFollowUp(CaseStudyFollowUp fu) {
followups.add(fu);
}

/**
* @return
*/
public CaseStudyPatientHistory getPatientHistory() {
return patientHistory;
}

/**
* @param history
*/
public void setPatientHistory(CaseStudyPatientHistory history) {
patientHistory = history;
}

/**
* @return
*/
public Set getFindings() {
return findings;
}

/**
* @return
*/
public Set getPathologies() {
return pathologies;
}

/**
* @return
*/
public Set getResults() {
return results;
}

/**
* @param set
*/
public void setFindings(Set set) {
findings = set;
}

/**
* @param set
*/
public void setPathologies(Set set) {
pathologies = set;
}

/**
* @param set
*/
public void setResults(Set set) {
results = set;
}

}


And then the mappings:

<class name="com.cti.portal.tutor.valueobject.CaseStudyGeneral" table="CASESTUDY_GENERAL">
<id name="caseStudyId" column="CaseStudyID" type="long">
<generator class="sequence">
<param name="sequence">CASESTUDYID_SEQ</param>
</generator>
</id>
<property name="caseName" />
<property name="caseDescription" />
<property name="internalCaseId" />
<property name="diseaseState" />
<property name="audience" />
<property name="accessType" />
<property name="facilityId"/>
<property name="caseOfMonth"/>
<property name="caseOfMonthAccessType"/>
<property name="dateCreated"/>
<property name="createdBy"/>
<property name="reviewStatus"/>
<property name="reviewedBy"/>
<property name="reviewDate"/>
<property name="dateModified"/>
<property name="modifiedBy"/>
<property name="referenceInfo"/>


<one-to-one name="patientHistory" cascade="all" class="com.cti.portal.tutor.valueobject.CaseStudyPatientHistory"/>

<!--
<many-to-one name="audienceTypeId" class="com.cti.portal.tutor.valueobject.CaseStudyAudience" column="audiencetype_id"/>
-->

<set name="findings" table="CASESTUDY_FINDINGS" inverse="true">
<key column="casestudyid"/>
<one-to-many class="com.cti.portal.tutor.valueobject.CaseStudyFindings"/>
</set>

<set name="followups" table="CASESTUDY_FOLLOWUP" inverse="true">
<key column="casestudyid"/>
<one-to-many class="com.cti.portal.tutor.valueobject.CaseStudyFollowUp"/>
</set>

<set name="results" table="CASESTUDY_RESULTS" inverse="true">
<key column="casestudyid"/>
<one-to-many class="com.cti.portal.tutor.valueobject.CaseStudyResults"/>
</set>

<set name="pathologies" table="CASESTUDY_PATHOLOGY" inverse="true">
<key column="casestudyid"/>
<one-to-many class="com.cti.portal.tutor.valueobject.CaseStudyPathology"/>
</set>


</class>

<class name="com.cti.portal.tutor.valueobject.CaseStudyPatientHistory" table="CASESTUDY_PATIENTHISTORY">
<id name="caseStudyId">
<generator class="foreign">
<param name="property">patientHistory</param>
</generator>
</id>
<property name="patientHistoryHPI" />
<property name="patientHistoryPastMedical" />
<property name="patientHistoryMedications" />
<property name="patientHistoryImage1" />
<property name="patientHistoryImage2" />
<property name="patientHistoryImage3" />
<property name="patientHistoryImagePosition"/>

<one-to-one name="caseStudy" class="com.cti.portal.tutor.valueobject.CaseStudyGeneral" constrained="true"/>
</class>


I tried looking in the FAQ for this error and I didn't see it. Usually I'd expect patientHistory getter/setter to not exist for this error, but it does seem to exist in CaseStudyGeneral. Any ideas?

Steve


Top
 Profile  
 
 Post subject: nevermind
PostPosted: Mon May 03, 2004 3:07 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 2:18 pm
Posts: 20
Just figured it out. I'm using the wrong property on the foreign key.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.