CodesJava

Easy learning with example program codes

JPA column annotation


The Column annotation is used to specify the mapped column for a persistent property or field. If no Column annotation is specified, the default value will be applied.

Example:

@Column(name="DESC", nullable=false, length=512)
public String getDescription() { 
	return description; 
}

Attribute:

Name: The name of the column.
length: The column length.
nullable: Whether the database column is nullable.
Table: The name of the table that contains the column.
Unique: Whether the column is a unique key.
updatable: Whether the column is included in SQL UPDATE statements generated by the persistence provider.
Precision: The precision for a decimal (exact numeric) column.
insertable: Whether the column is included in SQL INSERT statements generated by the persistence provider.
columnDefinition: The SQL fragment that is used when generating the DDL for the column.

Posted in JPA   


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap