As you can see.  I have a number of classes that have their own tables that extend the 
Entity Class.

Hibernate builds the tables perfectly, including the foreign key constraints.

However,  when I try to insert into any of the tables it says:

Error creating schema Repeated column in mapping for class 
com.jsi.business.entity.Entity should be mapped with insert="false" update="false": 
ENTITY_TYPE

I checked the database and it is there only once.

This value is held by Entity which is extended by Agency.  It is set by calling the 
setType in the parent class.

If I set insert and update to false it works fine; except then the application can't 
set the value.

The hbm.xml is set included

Thanks,

Robb
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY style="MARGIN-TOP: 2px; FONT: 8pt Tahoma; MARGIN-LEFT: 2px">
<DIV><FONT size=1></FONT>As you can see.&nbsp; I have a number of classes that 
have their own tables that extend the Entity Class.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Hibernate builds the tables perfectly, including the foreign key 
constraints.</DIV>
<DIV>&nbsp;</DIV>
<DIV>However,&nbsp; when I try to insert into any of the tables it says:</DIV>
<DIV>&nbsp;</DIV>
<DIV>Error creating schema Repeated column in mapping for class 
com.jsi.business.entity.Entity should be mapped with insert="false" 
update="false": ENTITY_TYPE</DIV>
<DIV>&nbsp;</DIV>
<DIV>I checked the database and it is there only once.</DIV>
<DIV>&nbsp;</DIV>
<DIV>This value is held by Entity which is extended by Agency.&nbsp; It is set 
by calling the setType in the parent class.</DIV>
<DIV>&nbsp;</DIV>
<DIV>If I set insert and update to false it works fine; except then the 
application can't set the value.</DIV>
<DIV>&nbsp;</DIV>
<DIV>The hbm.xml is set included</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robb<BR></DIV></BODY></HTML>
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN" 
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd";>

<hibernate-mapping>
    <class
        name="com.jsi.business.entity.Entity"
        table="ENTITY"
        proxy="com.jsi.business.entity.IEntity"
        dynamic-update="true"
        dynamic-insert="true"
        discriminator-value="Entity"
    >

        <id
            name="ID"
            column="ENTITY_ID"
            type="long"
        >
            <generator class="identity">
            </generator>
        </id>

        <property
            name="CEM"
            type="long"
            update="true"
            insert="true"
            column="CEM"
        />

        <property
            name="status"
            type="string"
            update="true"
            insert="true"
            column="STATUS"
            length="25"
        />

        <many-to-one
            name="type"
            class="com.jsi.util.JSIType"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="false"
            column="ENTITY_TYPE"
        />

        <set
            name="addresses"
            table="ADDRESS"
            lazy="true"
            inverse="false"
            cascade="none"
            sort="unsorted"
        >

              <key
                  column="ENTITY_ID"
              />

              <one-to-many
                  class="com.jsi.business.person.Address"
              />
        </set>

        <set
            name="emails"
            table="EMAIL"
            lazy="true"
            inverse="false"
            cascade="none"
            sort="unsorted"
        >

              <key
                  column="ENTITY_ID"
              />

              <one-to-many
                  class="com.jsi.business.person.Email"
              />
        </set>

        <set
            name="identifications"
            table="IDENTFICATION"
            lazy="true"
            inverse="false"
            cascade="none"
            sort="unsorted"
        >

              <key
                  column="ENTITY_ID"
              />

              <one-to-many
                  class="com.jsi.business.person.Identification"
              />
        </set>

        <set
            name="names"
            table="NAMES"
            lazy="true"
            inverse="false"
            cascade="none"
            sort="unsorted"
        >

              <key
                  column="ENTITY_ID"
              />

              <one-to-many
                  class="com.jsi.business.person.Name"
              />
        </set>

        <set
            name="phones"
            table="PHONE"
            lazy="true"
            inverse="false"
            cascade="none"
            sort="unsorted"
        >

              <key
                  column="ENTITY_ID"
              />

              <one-to-many
                  class="com.jsi.business.person.Phone"
              />
        </set>

        <many-to-one
            name="origin"
            class="com.jsi.util.JSIType"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="ENTITY_TYPE"
        />

        <property
            name="created"
            type="date"
            update="false"
            insert="true"
            column="created"
        />

        <property
            name="updated"
            type="date"
            update="false"
            insert="true"
            column="updated"
        />

        <property
            name="accessKey"
            type="long"
            update="true"
            insert="true"
            column="ACCESSKEY"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Entity.xml
            containing the additional properties and place it in your merge dir.
        -->

        <joined-subclass
            name="com.jsi.business.entity.Agency"
            table="AGENCY"
            dynamic-update="true"
            dynamic-insert="true"
            proxy="com.jsi.business.courtofficer.IAgency"
        >
        <key
            column="ENTITY_ID"
        />

        <many-to-one
            name="jurisdiction"
            class="com.jsi.business.court.Jurisdiction"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="JURISDICTION_ID"
        />

        <many-to-one
            name="agencyType"
            class="com.jsi.util.JSIType"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="AGENCYTYPE"
        />

        </joined-subclass>
        <joined-subclass
            name="com.jsi.business.entity.Agent"
            table="AGENT"
            dynamic-update="true"
            dynamic-insert="false"
            proxy="com.jsi.business.courtofficer.IAgent"
        >
        <key
            column="ENTITY_ID"
        />

        <many-to-one
            name="agency"
            class="com.jsi.business.entity.Agency"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="AGENCYID"
        />

        <property
            name="fromDate"
            type="date"
            update="true"
            insert="true"
            column="FROMDATE"
        />

        <many-to-one
            name="agencyRole"
            class="com.jsi.business.courtofficer.AgencyRole"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="ROLE_ID"
        />

        <property
            name="toDate"
            type="date"
            update="true"
            insert="true"
            column="TODATE"
        />

        </joined-subclass>
        <joined-subclass
            name="com.jsi.business.entity.Vehicle"
            table="VEHICLE"
            dynamic-update="true"
            dynamic-insert="false"
            proxy="com.jsi.business.entity.IVehicle"
        >
        <key
            column="ENTITY_ID"
        />
        <property
            name="commercialFlag"
            type="boolean"
            update="true"
            insert="true"
            column="COMMERCIAL_FLAG"
        />

        <many-to-one
            name="makeCode"
            class="com.jsi.util.JSIType"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            column="MAKE_CODE"
        />

        <many-to-one
            name="modelCode"
            class="com.jsi.util.JSIType"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            column="MODEL_CODE"
        />

        <many-to-one
            name="paintColor"
            class="com.jsi.util.JSIType"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            column="PAINT_COLOR"
        />

        <many-to-one
            name="styleCode"
            class="com.jsi.util.JSIType"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            column="STYLE_CODE"
        />

        <many-to-one
            name="vehicleType"
            class="com.jsi.util.JSIType"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            column="VEHICLE_TYPE"
        />

        </joined-subclass>

    </class>

</hibernate-mapping>

Reply via email to