Hibernate的蚂蚁工具 [英] Hibernate Ant Tools

查看:119
本文介绍了Hibernate的蚂蚁工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用休眠蚂蚁工具来生成hibernate的POJO类与注释。
什么是从现有的表使用Ant脚本?

POJO类生成策略

我想出了答案,我张贴。


解决方案

 如果表中列有NOT NULL约束,
然后与在生成的类中列的属性将是基本类型。如果表列没有NOT NULL约束,
然后与在生成的类中列的属性将是java.lang.X类型。
(X ==任何整数,字节,浮点型,双取决于数据库表列型)如果表列是有主键约束,
然后与在生成的类中列的属性将是基本类型。如果表列是有主键约束,这是AUTO INCREAMENT或外键,
然后与在生成的类中列的属性将是java.lang.X类型。
(X ==任何整数,字节,浮点型,双取决于数据库表列型)

I have used hibernate ant tool to generate hibernate pojo classes with annotations. What is the POJO class generation strategy from existing tables using ANT SCRIPT?

I figured out the answer and I'm posting it.

解决方案

If table column is having not null constraint, 
then a property related to that column in generated class will be of primitive type.

If table column is not having not null constraint, 
then a property related to that column in generated class will be of java.lang.X type.
(X == any of Integer,Byte,Float,Double depends on table column type in database)

If table column is having primary key constraint, 
then a property related to that column in generated class will be of primitive type.

If table column is having primary key constraint and it is AUTO INCREAMENT OR foreign key,
then a property related to that column in generated class will be of java.lang.X type.
(X == any of Integer,Byte,Float,Double depends on table column type in database)

这篇关于Hibernate的蚂蚁工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆