如果是用xml的方式配置映射,可以在<column>标签的sql-type属性中设置char(2),比如:  

1 <property name="age" type="java.lang.String"> 
2   <column name="age" sql-type="char(2)"></column> 
3 </property> 

 

    如果是注解的话,需要使用@Column的columnDefinition属性,比如:

@Column(name="age",columnDefinition="char(2)")
private String age;

  column注解中的columnDefinition属性用于覆盖数据库DDL中的语句,比如:

@Column(name="age" columnDefinition = "char(2) DEFAULT not null COMMENT '年龄'") 

 

相关文章:

  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-06
  • 2022-12-23
  • 2021-12-21
猜你喜欢
  • 2022-12-23
  • 2021-05-04
  • 2021-07-20
  • 2022-02-28
  • 2021-08-05
  • 2022-12-23
相关资源
相似解决方案