I am bit conflicted in modelling my entities.
We have an entity with around 6-8 instance variables. Two of them are not actually persisted in database, but only used for doing some validation or to display in UI. So when we fetch entity, we populate with some external lookup.
Now, according to one of my colleague its better practice use decorator instead of using @Transient. To a certain extent I agree. Because it clarifies actual model which DB represents.
But it will add additional boilerplate for some cases (e.g. for business I can name entity as MyEntityBO. But if I use it for UI...again name will be bit confusing.
My question is, what scenario its better to use @Transient rather then a decorator or vice-versa
Aucun commentaire:
Enregistrer un commentaire