To set the default value of a field with Hibernate, you can use the columnDefinition argument :
/** * Returns the file size of this Photo */ @Column(name="file_size",nullable=false,columnDefinition="bigint(20) default 0") public Long getFileSize() { return fileSize; } /** * Sets the file size of this Photo * * @param fileSize File size of this Photo */ public void setFileSize(Long fileSize) { this.fileSize = fileSize; }
Cool
great tip