Hibernate Ant Tools

那年仲夏 提交于 2020-01-06 03:40:26

问题


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.


回答1:


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)


来源:https://stackoverflow.com/questions/8563437/hibernate-ant-tools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!