Changeset 708


Ignore:
Timestamp:
04/27/11 23:31:56 (8 years ago)
Author:
philsmart
Message:
 
Location:
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/auxiliary/PrincipalInformation.java

    r705 r708  
    88 
    99    /** For Hibernate table id */ 
    10     private long persistantId; 
     10    private long principleId; 
    1111 
    12     /** The name of the school or department this principal is a member of*/ 
     12    /** The name of the school or department this principal is a member of */ 
    1313    private String school; 
    1414 
    15     /** The affiliation this principal has with their current school or department*/ 
     15    /** The affiliation this principal has with their current school or department */ 
    1616    private String affiliation; 
    1717 
    18  
    1918    /** 
    20      * @param school the school to set 
     19     * @param school 
     20     *            the school to set 
    2121     */ 
    2222    public void setSchool(String school) { 
    2323        this.school = school; 
    2424    } 
    25  
    26  
    2725 
    2826    /** 
     
    3331    } 
    3432 
    35  
    36  
    3733    /** 
    38      * @param affiliation the affiliation to set 
     34     * @param affiliation 
     35     *            the affiliation to set 
    3936     */ 
    4037    public void setAffiliation(String affiliation) { 
    4138        this.affiliation = affiliation; 
    4239    } 
    43  
    44  
    4540 
    4641    /** 
     
    5045        return affiliation; 
    5146    } 
    52  
    5347 
    5448    /** 
     
    6458                    this.getClass().getMethod(method.getName(), (Class[]) null); 
    6559                    Object object = method.invoke(this, (Object[]) null); 
    66                     if (object instanceof Collection){ 
    67                          builder.append(method.getName() + " [" + Arrays.asList(object) + "],"); 
    68                     } 
    69                     else{ 
     60                    if (object instanceof Collection) { 
     61                        builder.append(method.getName() + " [" + Arrays.asList(object) + "],"); 
     62                    } else { 
    7063                        builder.append(method.getName() + " [" + object + "],"); 
    7164                    } 
    72               } 
    73             } catch (Exception e){ 
    74                 //do nothing 
     65                } 
     66            } catch (Exception e) { 
     67                // do nothing 
    7568            } 
    7669        } 
    7770        builder.append("]"); 
    7871        return builder.toString(); 
    79  } 
    80  
    81  
    82  
    83     /** 
    84      * @param persistantId the persistantId to set 
    85      */ 
    86     public void setPersistantId(long persistantId) { 
    87         this.persistantId = persistantId; 
    8872    } 
    8973 
    90  
    91  
    92     /** 
    93      * @return the persistantId 
    94      */ 
    95     public long getPersistantId() { 
    96         return persistantId; 
     74    public void setPrincipleId(long principleId) { 
     75        this.principleId = principleId; 
    9776    } 
    9877 
    99  
    100  
    101  
    102  
    103  
     78    public long getPrincipleId() { 
     79        return principleId; 
     80    } 
    10481 
    10582} 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/event.hbm.xml

    r705 r708  
    4040                                index="principalname_index" /> 
    4141 
    42                         <one-to-one  name="principalInformation" 
    43                                 class="uk.ac.cardiff.model.event.auxiliary.PrincipalInformation" 
    44                                 /> 
     42                <!--  MUST use the cascade property, otherwise hibernate will think the referenced table is already persisted and will 
     43                try to link to it, when it may not be there. So we need to make sure it saves or updates the object during save or update of this 
     44                object --> 
     45             <many-to-one name="principalInformation" class="uk.ac.cardiff.model.event.auxiliary.PrincipalInformation" column="principalInformation_id"  
     46                cascade="save-update"/> 
    4547 
    4648                        <joined-subclass 
     
    8688 
    8789        <class name="uk.ac.cardiff.model.event.auxiliary.PrincipalInformation" 
    88                 table="principalInformation" dynamic-update="true" dynamic-insert="false"> 
    89                 <id name="persistantId" column="persistantId" type="long" 
    90                         unsaved-value="null"> 
    91                         <generator class="native"> 
    92                                 <param name="sequence">hib_persistent_info_seq</param> 
    93                         </generator> 
    94  
    95                 </id> 
     90                table="principalInformation" > 
     91         
     92                <id name="principleId" column="id" type="java.lang.Long"> 
     93            <generator class="increment"/> 
     94        </id> 
     95         
    9696                <property name="school" type="string" update="true" insert="true" column="school" index="school_index"/> 
    9797        <property name="affiliation" type="string" update="true" insert="true" column="affiliation" index="affiliation_index"/> 
Note: See TracChangeset for help on using the changeset viewer.