Recall & Review
beginner
What is the purpose of the @Column annotation in Spring Boot?
The @Column annotation maps a Java class field to a specific column in a database table. It helps customize column properties like name, length, and nullability.Click to reveal answer
beginner
How do you specify a custom column name using @Column?
Use the 'name' attribute inside @Column, for example: @Column(name = "user_email") maps the field to the 'user_email' column in the table.
Click to reveal answer
beginner
What does setting nullable = false in @Column do?
It makes the database column NOT NULL, meaning the column must always have a value and cannot be left empty.
Click to reveal answer
beginner
Can @Column control the length of a String column? How?
Yes, by setting the 'length' attribute, e.g., @Column(length = 100) limits the string column to 100 characters.
Click to reveal answer
beginner
What happens if you omit the @Column annotation on a field?
Spring Boot uses default mapping: the field name becomes the column name, and default settings apply for length, nullability, etc.
Click to reveal answer
Which attribute of @Column sets the database column name?
✗ Incorrect
The 'name' attribute specifies the exact column name in the database.
What does @Column(nullable = false) enforce?
✗ Incorrect
Setting nullable = false means the column cannot be empty (NOT NULL).
How do you limit a String column to 50 characters using @Column?
✗ Incorrect
The 'length' attribute controls the maximum size of a String column.
If you do not use @Column on a field, what happens?
✗ Incorrect
Without @Column, default mapping uses the field name as the column name.
Which @Column attribute ensures column values are unique?
✗ Incorrect
The 'unique' attribute enforces uniqueness of column values.
Explain how to use @Column to customize a database column in Spring Boot.
Think about how you control column name, size, and whether it can be empty.
You got /4 concepts.
Describe what happens if you omit the @Column annotation on a field in a Spring Boot entity.
Consider the default mapping rules Spring Boot applies.
You got /3 concepts.