hibernate映射文件无法使用length指定int和Integer类型字段长度,正向生成的表中int和 Integer类型属性生成字段均为固定长度11
People.hbm.xml:
<hibernate-mapping package="com.wd.pojo">
<class name="People" table="t_people">
<id name="id" column="id" length="5">
<generator class="native"></generator>
</id>
<property name="age" length="5" column="age"></property>
<property name="height" length="5" column="height" type="java.lang.Integer"></property>
<property name="name" length="20"></property>
</class>
</hibernate-mapping>
生成的mysql数据库中的ddl:
CREATE TABLE `t_people` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`age` int(11) DEFAULT NULL,
`height` int(11) DEFAULT NULL,
`name` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;