Hi, I have 2 applications:
- Manager UI - Which should be able to create a user with all its fields (username, email, age etc.) and display them.
- Core component - which only need the UserId and Username field, and need to be very performant. It also shouldn't be able to write to the database.
It seems I need 2 different models, one for the UI application and a second one for the core component. When I create the 1st model, life's good. But when I try to create the 2nd model, I get all the unneccessary fields. If I try to delete them - I manage to do that only for the nullable fields, but not for the required ones (which is only required for saving, actually). Here's what I get: "Column Users.email in table Users must be mapped: It has no default value and is not nullable."
Setting the "email" field as private getter & setter will not solve my issue, since I don't want to store the value at all on the entity (and fetch the field from the database) - as I said, this application needs to be as performant as possible.
I believe that if I could somehow set the model as read-only, it will solve this, but it's only a hunch (and I couldn't find a way to do that - is therer?)
Any help would be appreciated. Thanks, Nir.