Hi,
I search the forum but didn't find a solution to my problem. I'm sure it's something easy to do for someone that actually now what he's doing :)
I have a table with many-to-one associations to 3 lookup tables. Those lookup tables will never get updated nor will they have rows inserted.
Everytime I update/save the parent table (new row), I get "org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: hibernate.OrgDeptLocation".
Yes, I do create an object of type OrgDeptLocation in PersonPosition.orgDeptLocation, I have to (long story - using JSF & BeanUtils.copyPropertie).
What do I have to do to my lookup table's XML file to make sure whatever I do in my code, hibernate won't try to update/insert/delete/create in it.
Thanks
Hibernate version: 3.1 rc2
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class name="hibernate.PersonPosition" table="PERSON_POSITION" lazy="true">
<id name="positionId" type="java.lang.Integer" column="Position_ID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="cid" type="java.lang.Integer" column="CID" not-null="true" length="6"/>
<property name="positionType" type="java.lang.Integer" column="Position_Type" length="4"/>
<property name="primaryOrgInd" type="java.lang.String" column="Primary_Org_Ind" length="1"/>
<property name="salariedInd" type="java.lang.String" column="Salaried_Ind" length="1"/>
<property name="employmentType" type="java.lang.Integer" column="Employment_Type" length="4"/>
<property name="leaveOfAbsenceInd" type="java.lang.String" column="Leave_Of_Absence_Ind" length="1"/>
<property name="positionStartYear" type="java.lang.Short" column="Position_Start_Year" length="5"/>
<property name="positionEndYear" type="java.lang.Short" column="Position_End_Year" length="5"/>
<property name="otherOrgName" type="java.lang.String" column="Other_Org_Name" length="100"/>
<property name="otherDepartmentName" type="java.lang.String" column="Other_Department_Name" length="100"/>
<property name="otherPositionName" type="java.lang.String" column="Other_Position_Name" length="40"/>
<property name="addressTitleLine2" type="java.lang.String" column="Address_Title_Line2" length="40"/>
<property name="phoneCountryCode" type="java.lang.String" column="Phone_Country_Code" length="3"/>
<property name="phoneAreaCode" type="java.lang.String" column="Phone_Area_Code" length="4"/>
<property name="phoneNumber" type="java.lang.String" column="Phone_Number" length="12"/>
<property name="phoneExtension" type="java.lang.String" column="Phone_Extension" length="5"/>
<property name="faxCountryCode" type="java.lang.String" column="FAX_Country_Code" length="3"/>
<property name="faxAreaCode" type="java.lang.String" column="FAX_Area_Code" length="4"/>
<property name="faxNumber" type="java.lang.String" column="FAX_Number" length="12"/>
<property name="faxPhoneExtension" type="java.lang.String" column="FAX_Phone_Extension" length="5"/>
<property name="emailAddress" type="java.lang.String" column="EMail_Address" length="100"/>
<property name="scndEmailAddress" type="java.lang.String" column="Scnd_EMail_Address" length="100"/>
<property name="dateAppointed" type="java.sql.Timestamp" column="Date_Appointed" length="23"/>
<property name="personInd" type="java.lang.String" column="Person_Ind" length="1"/>
<property name="scndPhoneCountryCode" type="java.lang.String" column="Scnd_Phone_Country_Code" length="3"/>
<property name="scndPhoneAreaCode" type="java.lang.String" column="Scnd_Phone_Area_Code" length="4"/>
<property name="scndPhoneNumber" type="java.lang.String" column="Scnd_Phone_Number" length="12"/>
<property name="scndPhoneExtension" type="java.lang.String" column="Scnd_Phone_Extension" length="5"/>
<property name="scndFaxCountryCode" type="java.lang.String" column="Scnd_FAX_Country_Code" length="3"/>
<property name="scndFaxPhoneAreaCode" type="java.lang.String" column="Scnd_FAX_Phone_Area_Code" length="4"/>
<property name="scndFaxPhoneNumber" type="java.lang.String" column="Scnd_FAX_Phone_Number" length="12"/>
<property name="scndFaxPhoneExtension" type="java.lang.String" column="Scnd_FAX_Phone_Extension" length="5"/>
<property name="createUserId" type="java.lang.String" column="Create_User_ID" length="3" insert="false" update="false"/>
<property name="createDate" type="java.sql.Timestamp" column="Create_Date" length="23" insert="false" update="false"/>
<property name="changeUserId" type="java.lang.String" column="Change_User_ID" length="3" insert="false" update="false"/>
<property name="changeDate" type="java.sql.Timestamp" column="Change_Date" length="23" insert="false" update="false"/>
<property name="notCurrentlyRegistered" type="java.lang.String" column="Not_Currently_Registered" length="1"/>
<property name="positionStartMonth" type="java.lang.String" column="Position_Start_Month" length="2"/>
<property name="positionEndMonth" type="java.lang.String" column="Position_End_Month" length="2"/>
<property name="originalOrgId" type="java.lang.Integer" column="Original_Org_ID" length="8"/>
<property name="originalOrgDeptLocId" type="java.lang.Integer" column="Original_Org_Dept_Loc_ID" length="6"/>
<!-- associations -->
<!-- <property name="orgDeptLocId" type="java.lang.Integer" column="Org_Dept_Loc_ID" length="6"/> -->
<many-to-one name="orgDeptLocation" class="hibernate.OrgDeptLocation" column="Org_Dept_Loc_ID" insert="false" update="true" cascade="none"> </many-to-one>
<!-- <property name="orgId" type="java.lang.Integer" column="Org_ID" length="8"/> -->
<many-to-one name="organization" class="hibernate.Organization" column="Org_ID" insert="false" update="true"> </many-to-one>
<!-- <property name="positionNumber" type="java.lang.Integer" column="Position_Number" length="4"/> -->
<many-to-one name="positionNumber" class="hibernate.Cod" column="Position_Number" insert="false" update="true"> </many-to-one>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class name="hibernate.OrgDeptLocation" table="ORG_DEPT_LOCATION" mutable="false" lazy="true">
<cache usage="read-only"/>
<id name="orgDeptLocId" type="java.lang.Integer" column="Org_Dept_Loc_ID">
<generator class="assigned"/>
</id>
<property name="orgId" type="int" column="Org_ID" not-null="true" length="8"/>
<property name="departmentCategoryCode" type="int" column="Department_Category_Code" not-null="true" length="4"/>
<property name="locationId" type="java.lang.Integer" column="Location_ID" not-null="true" length="4"/>
<property name="statusCode" type="int" column="Status_Code" not-null="true" length="4"/>
<property name="shortNameEnglish" type="java.lang.String" column="Short_Name_English" length="60"/>
<property name="shortNameFrench" type="java.lang.String" column="Short_Name_French" length="60"/>
<property name="departmentNameEnglish" type="java.lang.String" column="Department_Name_English" not-null="true" length="100"/>
<property name="departmentNameFrench" type="java.lang.String" column="Department_Name_French" not-null="true" length="100"/>
<property name="statusChangedDate" type="java.sql.Timestamp" column="Status_Changed_Date" not-null="true" length="23"/>
<property name="sigDeptFulltimeTeachers" type="java.lang.Short" column="SIG_Dept_Fulltime_Teachers" length="5"/>
<property name="fmsVendorCode" type="java.lang.String" column="FMS_Vendor_Code" length="9"/>
<property name="emailAddress" type="java.lang.String" column="EMail_Address" length="100"/>
<property name="phoneCountryCode" type="java.lang.String" column="Phone_Country_Code" length="3"/>
<property name="phoneAreaCode" type="java.lang.String" column="Phone_Area_Code" length="4"/>
<property name="phoneNumber" type="java.lang.String" column="Phone_Number" length="12"/>
<property name="phoneExtension" type="java.lang.String" column="Phone_Extension" length="5"/>
<property name="faxPhoneCountryCode" type="java.lang.String" column="FAX_Phone_Country_Code" length="3"/>
<property name="faxAreaCode" type="java.lang.String" column="FAX_Area_Code" length="4"/>
<property name="faxNumber" type="java.lang.String" column="FAX_Number" length="12"/>
<property name="faxPhoneExtension" type="java.lang.String" column="FAX_Phone_Extension" length="5"/>
<property name="deptWebAddress" type="java.lang.String" column="Dept_Web_Address" length="100"/>
<property name="createUserId" type="java.lang.String" column="Create_User_ID" length="3"/>
<property name="createDate" type="java.sql.Timestamp" column="Create_Date" length="23"/>
<property name="changeUserId" type="java.lang.String" column="Change_User_ID" length="3"/>
<property name="changeDate" type="java.sql.Timestamp" column="Change_Date" length="23"/>
</class>
</hibernate-mapping>
Name and version of the database you are using: ASE 12.0.0.1