-->
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.  [ 1 post ] 
Author Message
 Post subject: Repeated Column in mapping for entity-Not able to insert/upd
PostPosted: Fri Jul 30, 2010 11:29 am 
Newbie

Joined: Mon May 03, 2010 6:36 pm
Posts: 5
Hi

We have 2 tables and these are their columns & relationships
Code:
Table 1: PTNT_MSR

Columns :
PTNT_DATA_MSRMNT_CLCTN_ID : PK
PTNT_PRCTC_PRFMNC_YR_ID
DEMO_PRCTC_DATA_CLCTN_PRD_ID

Table 2: PTNT_DTL

Columns:
PTNT_DTL_ID : PK
PTNT_DATA_MSRMNT_CLCTN_ID : FK
PTNT_1ST_NAME
PTNT_MDL_NAME
PTNT_LAST_NAME


There are some more columns in PTNT_DTL which I have left out and one more table that is not needed.

Hibernate mapping:

Code:
<class name="PatientDataMeasure" table="PTNT_MSR">
    <id name="patientDataMeasurementCollectionId"
        column="PTNT_DATA_MSRMNT_CLCTN_ID"
        type="long">
      <generator class="assigned" />
    </id>
    <property name="demoCollectionPeriodId"
              column="DEMO_PRCTC_DATA_CLCTN_PRD_ID"
              type="long" />
   
    <many-to-one name="patientDetail" class="PatientDetail" property-ref="patientDataMeasurementCollectionId"
    column="PTNT_DATA_MSRMNT_CLCTN_ID" fetch="join" not-null="true" insert="false" update="false" />
   
    <many-to-one name="patientPracticePerformanceYear" class="PatientPracticePerformanceYear"
    column="PTNT_PRCTC_PRFMNC_YR_ID" fetch="join" not-null="true" insert="false" update="false" />
  </class>


The code works fine for select(get/load). The problem is when I try to insert/update PatientDetail. If i remove insert="false" and update="false", then I get the error:
Code:
gov.hhs.cms.ehrds.datacollection.model.PatientDataMeasurementCollection column: PTNT_DATA_MSRMNT_CLCTN_ID (should be mapped with insert="false" update="false")

Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: gov.hhs.cms.ehrds.datacollection.model.PatientDataMeasurementCollection column: PTNT_DATA_MSRMNT_CLCTN_ID (should be mapped with insert="false" update="false")


I understand that the column "PTNT_DATA_MSRMNT_CLCTN_ID" is repeated. Is there any other way to go about this. I need to save/update the PatientDetails. Appreciate your suggestions


Thanks

Harish


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.