• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate default value to column

 
S Subbu
Ranch Hand
Posts: 87
jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI TO ALL,

i am new to Hibernate , Still i am in learinging stage.

i am using hbm2ddl.auto and i want to set default value to my column. how can i set using Annotation

For Example

@Column(name="BASICNAME",length=20,nullable=false)

i am using above statement , how can i set default value to Basic Name Field.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure it can be done at the annotation level.

Why not put one in the constructor when a new Entity is instantiated?

Also, you could most definitely assign one at the Database DML level.

WP
 
H Paul
Ranch Hand
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try columnDefinition
part of @Column
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic