Quizzes@Column Mapping — Concept Check
intermediate
hibernate

@Column Mapping — Concept Check

Questions on @Column Mapping. @Column maps a field to a specific column with custom name, length, precision, nullable, and unique constraints that are honoured during schema generation and validation.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on @Column Mapping — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer wants to ensure a field is never updated after its initial insertion. Which @Column attribute should they use?

    • Anullable=false
    • Binsertable=false
    • Cunique=true
    • Dupdatable=false
  2. 2.In a JPA entity, a field is annotated with @Column(length = 100). What does this imply?

    • AThe field cannot exceed 100 characters in length.
    • BThe field is a DECIMAL with precision 100.
    • CThe field is a unique identifier.
    • DThe field must be exactly 100 characters long.
  3. 3.A developer uses @Column(name = "user_email", nullable = false). What will happen if they try to insert a null value?

    • AThe null value is inserted without error.
    • BAn exception is thrown at runtime.
    • CThe column is ignored during insertion.
    • DA default value is inserted instead.
  4. 4.Which attribute would you use to map a field to a database-specific SQL type?

    • Alength
    • BcolumnDefinition
    • Cname
    • Dunique
  5. 5.A field in a JPA entity is mapped with @Column(precision = 5, scale = 2). What does this mean?

    • AThe field is unique with a length of 5.
    • BThe field must be exactly 5 characters long.
    • CThe field is a DECIMAL with 5 digits and 2 decimal places.
    • DThe field is a VARCHAR with a length of 5.
  6. 6.A developer is surprised to see a column named 'user_name' instead of 'userName' in their database. What might explain this?

    • AThe column was defined with columnDefinition.
    • BThe developer manually renamed the column.
    • CSpring Boot's default naming strategy converts camelCase to snake_case.
    • DThe database does not support camelCase names.
  7. 7.An entity field is annotated with @Column(insertable = false). What is the effect during insertion?

    • AThe field is excluded from INSERT statements.
    • BThe field is always set to null during insertion.
    • CThe field is set to a default value during insertion.
    • DThe field is included in INSERT but not UPDATE statements.
  8. 8.How does the @Column(unique = true) attribute affect a database column?

    • AIt enforces a UNIQUE constraint on the column.
    • BIt ensures the column is indexed.
    • CIt sets the column to accept only non-null values.
    • DIt allows the column to be updated only once.