Spring Data JPA Annotations

 

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@Entity
@Entity
@Entity

@Entity anotation declares a class as an entity.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@Table(name="tbl_sky")
@Table(name="tbl_sky")
@Table(name="tbl_sky")

@Table anotation defines the table, catalog, and schema name for your entity.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@Id
@Id
@Id

@Id defines the unique identifier for your entity.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@Column
@Column
@Column

@Column defines a column and its characteristics such as column name, column updatable or not, etc

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@GeneratedValue
@GeneratedValue
@GeneratedValue

@GeneratedValue defines how the id column is generated.

 

@OnDelete defines what orphan tables should do on delete

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@OnDelete(action = OnDeleteAction.CASCADE)
@OnDelete(action = OnDeleteAction.CASCADE)
@OnDelete(action = OnDeleteAction.CASCADE)

 




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

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