title: Setting default value of a coloumn using hibernate annotations in postgresql
body: <p>I want to set default value of integer value in my table using hibernate annotations.It works but when i give default value as 1 it always set it to zero in the database.I don't know what i am doing wrong.Any help will be appreciated</p>
  
  <p>This is what i am using</p>
  
  <pre><code>@Column(name = "interval",nullable = false, columnDefinition = “int default 1")
  private int interval;
  </code></pre>
  
  <p>I have checked almost all the links i dont know when i am setting the value to be 1 then why 0 is getting stored in the database</p>
  
  <p>I know we can do it as </p>
  
  <pre><code>@Column(name = "interval",nullable = false, columnDefinition = “int default 1")
  private int interval = 1;
  </code></pre>
  
  <p>but i dont want to set the value as above I want to know to any way to set the default value using hibernate</p>
  
  <p>I had already seen these links 
  <a href="https://stackoverflow.com/questions/3110266/how-to-set-default-value-in-hibernate">How to set default value in Hibernate</a>
  <a href="https://stackoverflow.com/questions/13070682/set-default-values-using-hibernate-annotations-in-mysql">Set default values using hibernate annotations in MYSQL</a></p>