I'm getting the following error when deploying my code. I think it is a problem with the mapping, but I don't know what's wrong with it. I've included my mapping file, database create so you know how the table was created, a domain object snipet, and the Hibernate properties I have set. I'm using xdoclet2 to create the mapping file. I'm running this on Weblogic 8.1.6, Windows XP (development environment), DB2 8.x, Spring 2.0.5, and Hibernate 3.2.3.ga. I've tried this while using double and Double as the types in the domain object, and I get the same error, except "numeric(6,2)" was replaced with "double". Any ideas what I've done wrong?
error
org.hibernate.HibernateException: Wrong column type: RATE, expected: numeric(6,2)
at org.hibernate.mapping.Table.validateColumns(Table.java:251)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1007)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
mapping
<hibernate-mapping>
<class table="PROJECT_FINANCE_RATE_EMPLOYEE" name="com...FinanceRateEmployee">
<composite-id unsaved-value="none" name="financeRateEmployeeID" class="com...FinanceRateEmployeeID">
<key-property name="costCenter" column="COST_CENTER"/>
<key-property name="effectiveDate" column="EFFECTIVE_DATE" type="date"/>
<key-property name="eptRole" column="EPT_ROLE_ID" type="integer"/>
<key-property name="orgId" column="ORG_ID"/>
</composite-id>
<property name="createdAt" column="CREATED_AT" type="timestamp"/>
<property name="createdBy" column="CREATED_BY"/>
<property name="lastChangedAt" column="LAST_CHANGED_AT" type="timestamp"/>
<property name="lastChangedBy" column="LAST_CHANGED_BY"/>
<property name="rate" scale="2" column="RATE" precision="6" type="big_decimal"/>
</class>
</hibernate-mapping>
database create statement for the table
CREATE TABLE "EPTOWNER"."PROJECT_FINANCE_RATE_EMPLOYEE"
("ORG_ID" VARCHAR(10) NOT NULL,
"COST_CENTER" VARCHAR(10) NOT NULL,
"EPT_ROLE_ID" INTEGER NOT NULL,
"EFFECTIVE_DATE" DATE NOT NULL,
"RATE" DECIMAL(6, 2) NOT NULL,
"CREATED_BY" VARCHAR(8) NOT NULL,
"CREATED_AT" TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP,
"LAST_CHANGED_BY" VARCHAR(8) NOT NULL,
"LAST_CHANGED_AT" TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP
)
domain object snipet
private BigDecimal rate;
/**
* @hibernate.property column="RATE"
* type="big_decimal"
* precision="6"
* scale="2"
* @return rate
*/
public BigDecimal getRate() {
return rate;
}
public void setRate(BigDecimal rate) {
this.rate = rate;
}
hibernate Properties I have set
<prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<prop key="hibernate.show_sql">true</prop>
|