2011-12-19 65 views
1

我用hibernate ant工具生成帶註釋的hibernate pojo類。 使用ANT SCRIPT從現有表格中生成POJO類的策略是什麼?休眠螞蟻工具

我想出了答案,我發佈了它。

回答

3
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)