我使用Hibernate Tools从带注释的类生成* .hbm文件。我有一个带注释的课程如下:
@Entity
@Table(name = "COUNTRIES")
public class Countries implements java.io.Serializable { {
// ...
@Id
@Column(name = "COUNTRY_ID", unique = true, nullable = false, length = 2)
public String getCountryId() {
return this.countryId;
}
// ...
}
这是我生成的hibernate映射文件
<class name="com.hibernate.domain.Countries" table="COUNTRIES">
<id name="countryId" type="java.lang.String">
<column name="COUNTRYID" />
<generator class="assigned" />
</id>
<many-to-one name="regions" class="com.hibernate.domain.Regions" fetch="join">
<column name="REGIONS" />
</many-to-one>
<property name="countryName" type="java.lang.String">
<column name="COUNTRYNAME" />
</property>
<set name="locationses" table="LOCATIONS" inverse="false" lazy="true">
<key>
<column name="COUNTRYID" />
</key>
<one-to-many class="com.hibernate.domain.Locations" />
</set>
</class>
在映射文件中,列COUNTRY_ID的属性长度是丢失,与具有缩放和精度的数值数据类型相同。我该怎么做才能在Hibernate Tools中解决这个问题?