Issue
hello I would like to consult. What happens if in a table already created previously I try to map it to an entity but I forget to map a field. What happens to that field in the table and what will its behavior be if I try to use crud methods?
For example , My table has Id, Name, Age, country but in my class I'm just mapping Id, name, Age.
Solution
Your JPA provider will simply ignore unmapped columns: They won't be read, and values for them will be omitted on INSERT
.
This can actually be useful; if you find yourself frequently needing only a few columns from a large table, you can create a *View
class (usually with only getters, no setters) that's explicitly mapped to the table and only fetches/exposes those columns.
Answered By - chrylis -cautiouslyoptimistic-
Answer Checked By - Marilyn (JavaFixing Volunteer)