Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1.2
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.imsweb.seerdms.shared.entity.Tiger2004" table="TIGER_2004" mutable="false">
<composite-id>
<key-property name="tigerLineId" column="TLID" type="java.lang.Long" length="10"/>
<key-property name="extAddressDataRecordSequenceNumber" column="EAD_RTSQ" type="java.lang.Integer" length="3"/>
<key-property name="shapePointRecordSequenceNumber" column="SP_RTSQ" type="java.lang.Integer" length="3"/>
</composite-id>
<!-- Extended Address Data components -->
<property name="extLeftStartAddress" column="EAD_FRADDL" type="java.lang.String" length="11"/>
<property name="extLeftEndAddress" column="EAD_TOADDL" type="java.lang.String" length="11"/>
...
</class>
</hibernate-mapping>
Name and version of the database you are using: Oracle 10.1
I am migrating our application from 2.1.8 to 3.1.2 and have ran into an issue involving composite identifiers and how they are handled between the two versions. The composite-id for the mapping above contains three properties in which nulls may possibly exist. This mapping works correctly with Hibernate 2.1.8, probably shouldn't, but does not work with Hibernate 3.1.2. With Hibernate 3.1.2, when one of the properties that makes up the primary key is null, the value returned from a query is null. I suggested to my supervisor that we recreate the table adding a column that is an artificial primary key, but he does not find that solution preferential. Does anyone know of a good solution for mapping a table that has a composite-id with pieces that may be null?
Thank you,
Mike Ringrose
P.S. Should ComponentType throw an exception when it encounters a composite-id with null parts? Seems like it should since it's masking an application error.