Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Eclipse Mars 中使用JPA 工具生成实体类。它生成整数数据类型的数据成员,该数据类型是表中的小整数类型。我需要为表中的小整数类型的列生成短类型的数据类型。
我认为这样的事情可能会起作用:-
@Column(columnDefinition = "SMALLINT") @Type(type = "org.hibernate.type.ShortType") private short variableName;
在选择 table->table Association->Customize Defaults->customize indicidual Entities 后从表向导中输入 JPA 实体 .. 在这里您可以自定义您的表
但通常它会自动将 smallint 类型转换为 short 类型。