there are two type of annotations (DDL and validation types) in your example:
@Column(unique = true, length = 254)
@NotNull
- @NotNull is a JSR 303 Bean Validation annotation. It has nothing to do with database constraints itself. It's used by validation processor and doen't connected with DB. so it's not redundant in your mapping.
But , for example
@Column(nullable = false) - it gives the jpa provider hints to generate the right DDL for creating table columns with the database constraints
2.@Column(unique = true, length = 254) they are hints for ddl that hibernate generate.
BUT for @Column(updatable = false, name = "flight_name", nullable = false, length=50)
updatable - it's not ddl , it's optimization.
from hibernate docs
@Column(
ddl/mapping : name="columnName";
optimization: boolean insertable() default true;
optimization: boolean updatable() default true;
ddl/mapping : String table() default "";
DDL -->: boolean unique() default false;
DDL -->: boolean nullable() default true;
DDL -->: String columnDefinition() default "";
DDL -->: int length() default 255;
......
)
If you use ddl scripts all hibernate ddl-annotation attributes are redundant (if you use in memory tests , there will be autogenaration for in-memory db ), and will be used only if you configured hibernate.hbm2ddl.auto option in hibernate/jpa config. Also it's very dangerous scenarios when you give hibernate permission to do DDL in production.
for work with production : see liquibase , flywaydb for DDL.