Nandkumar Tekale
Nandkumar Tekale

Reputation: 16158

Hibernate Ant Tools

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.

Upvotes: 1

Views: 280

Answers (1)

Nandkumar Tekale
Nandkumar Tekale

Reputation: 16158

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)

Upvotes: 3

Related Questions