In my application, I have to create 100's of Shipment objects upon request since the user can create sequences of Shipments before they are individual entered into the system. This is to help facilitate customs tracking in advance. However, when I create these new Shipment objects, I only need to set a few properties (the rest can be null). Considering the size of the Shipment mapping below, should I create another base class for Shipment (called ExpectedShipment or something) with just those properties that I'm going to set/query against? Will this improve creation performance? Thanks.
Code:
<class name="com.borderconnect.domain.shipment.Shipment" table="shipment">
<id name="id" column="id" type="long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">rns_transaction_id_seq</param>
</generator>
</id>
<component name="cargoControlNumber" class="com.borderconnect.domain.shipment.CargoControlNumber">
<many-to-one name="carrierCode" column="carrier_code_id"
class="com.borderconnect.domain.shipment.CarrierCode" cascade="save-update" />
<property name="sequence" column="sequence" />
<component name="parsPosition" class="com.borderconnect.domain.shipment.ParsPosition">
<property name="name" column="pars_position"/>
</component>
</component>
<property name="transactionNumber" column="transaction_number" />
<many-to-one name="serviceOption" column="service_option_id" class="com.borderconnect.domain.shipment.ServiceOption" outer-join="false" />
<many-to-one name="releaseOffice" column="release_office_id" class="com.borderconnect.domain.shipment.ReleaseOffice" outer-join="false" />
<many-to-one name="subLocation" column="sub_location_id"
class="com.borderconnect.domain.shipment.SubLocation" outer-join="false"
access="field" />
<property name="containerNumber" column="container_number" />
<bag name="statusMessages" table="shipment_status" inverse="true"
order-by="date desc" cascade="save-update" outer-join="true" lazy="true">
<key column="shipment_id"/>
<one-to-many class="com.borderconnect.domain.shipment.ShipmentStatus" />
</bag>
<bag name="comments" table="shipment_comment" inverse="true"
order-by="post_date asc" cascade="all-delete-orphan" outer-join="true" lazy="true">
<key column="shipment_id"/>
<one-to-many class="com.borderconnect.domain.shipment.ShipmentComment" />
</bag>
<many-to-one name="currentStatus" column="current_status_id"
class="com.borderconnect.domain.shipment.ShipmentStatus"
outer-join="false" access="field" />
<many-to-one name="driver" column="driver_id"
class="com.borderconnect.domain.Driver" />
<many-to-one name="sequence" column="shipment_sequence_id"
class="com.borderconnect.domain.shipment.sequence.Sequence" />
<property name="isPurged" column="is_purged" />
</class>