[SOLVED] JPA @Column annotation to create comment/description

Issue

I was wondering is it possible to create from jpa/hibernate annotation a database column description/comment like this:

ALTER TABLE tablename CHANGE status status INT(11) NOT NULL COMMENT 'sample description/comment';

It will be great functionality, but I cant find anything about this in JPA specification.

Maybe I should use @Column(columnDefinition="") property, but I dont have any clue.
Please help

Solution

I found answer for my own question.

I am not sure is it ok? Will it work for all Databases?

For sure it works for mysql.

Here is the working code:

@Column(columnDefinition=" INT(11) NOT NULL COMMENT '0 for no action, 1 for executed, 2 for validated, 3 for aproved'")
private int status;

Answered By – masterdany88

Answer Checked By – Robin (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *