0
0
Spring Bootframework~10 mins

Column mapping with @Column in Spring Boot - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the database column name for the field.

Spring Boot
public class User {
    @Column(name = "[1]")
    private String username;
}
Drag options to blanks, or click blank then click option'
Auser_name
BuserName
Cusername
Duser-name
Attempts:
3 left
💡 Hint
Common Mistakes
Using the Java field name directly without matching the database column name.
Using camelCase instead of snake_case for column names.
2fill in blank
medium

Complete the code to make the column non-nullable in the database.

Spring Boot
public class Product {
    @Column(name = "price", [1] = false)
    private Double price;
}
Drag options to blanks, or click blank then click option'
Aupdatable
Bnullable
Cinsertable
Dunique
Attempts:
3 left
💡 Hint
Common Mistakes
Using unique instead of nullable to control nullability.
Omitting the attribute and expecting non-null behavior.
3fill in blank
hard

Fix the error in the annotation to set the column length to 100 characters.

Spring Boot
public class Employee {
    @Column(name = "email", length = [1])
    private String email;
}
Drag options to blanks, or click blank then click option'
A"100"
Bsize
Clength
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number in quotes, which causes a type error.
Using incorrect attribute names like size.
4fill in blank
hard

Fill both blanks to make the column unique and not nullable.

Spring Boot
public class Category {
    @Column(name = "category_name", [1] = true, [2] = false)
    private String categoryName;
}
Drag options to blanks, or click blank then click option'
Aunique
Bnullable
Cinsertable
Dupdatable
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing insertable or updatable with uniqueness or nullability.
Swapping the values true/false incorrectly.
5fill in blank
hard

Fill all three blanks to map the field with a custom column name, set length to 50, and make it non-updatable.

Spring Boot
public class Order {
    @Column(name = "[1]", length = [2], updatable = [3])
    private String orderCode;
}
Drag options to blanks, or click blank then click option'
Aorder_code
B50
Cfalse
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using string quotes around the length number.
Setting updatable to true when it should be false.