gloeglm wrote:
are you really using integer/int everywhere? Please show your mapping, database schema and composite-id class.
here is the mapping:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.mycompany.bs115.Gpfb115Abc" table="Gpfb115Abc">
<composite-id name="compId" class="com.mycompany.bs115.PKGpfb115Abc">
<key-property name="budgetType_" column="budget_type" type="string" length="1"/>
<key-property name="budgetYear_" column="budget_year" type="string" length="4"/>
<!--
<key-property name="bonusMonth_" type="string" column="bonus_month" length="2">
-->
<key-property name="bonusMonth_" type="integer" column="bonus_month" >
<column name="bonus_month" sql-type="number(3)"/>
</key-property>
<!-- column name="bonus_month" sql-type="number(10)"/ -->
<key-property name="locationCode_" column="location_code" type="string" length="2"/>
<key-property name="bonusType_" column="bonus_type" type="string" length="2"/>
</composite-id>
<property name="bonusRate" not-null="true" type="integer">
<column name="bonus_rate" sql-type="number(3)"/>
</property>
<property name="lastUpdateDate" column="last_update_date" type="timestamp"/>
<many-to-one name="modifiedBy_" class="com.mycompany.user.Gpfb301" column="modified_by"/>
</class>
</hibernate-mapping>
here is the database schema (generated using hibernate's schemaexport)
create table Gpfb115Abc (
budget_type VARCHAR2(1) not null,
budget_year VARCHAR2(4) not null,
bonus_month NUMBER(10,0) not null,
location_code VARCHAR2(2) not null,
bonus_type VARCHAR2(2) not null,
bonus_rate number(3),
last_update_date DATE,
modified_by VARCHAR2(10),
primary key (budget_type, budget_year, bonus_month, location_code, bonus_type)
);
and here is the PK Class (generated using hibernate's hbm2java.CodeGenerator)
public class PKGpfb115Abc implements Serializable {
/** identifier field */
private String budgetType_;
/** identifier field */
private String budgetYear_;
/** identifier field */
private int bonusMonth_;
/** identifier field */
private String locationCode_;
/** identifier field */
private String bonusType_;
/** full constructor */
public PKGpfb115Abc(String budgetType_, String budgetYear_, int bonusMonth_, String locationCode_, String bonusType_) {
this.budgetType_ = budgetType_;
this.budgetYear_ = budgetYear_;
this.bonusMonth_ = bonusMonth_;
this.locationCode_ = locationCode_;
this.bonusType_ = bonusType_;
}
// the rest of the class is not shown